:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #818cf8;

    --color-remote: #38bdf8;
    --color-absent: #fbbf24;
    --color-office: #34d399;
    --color-danger: #f87171;

    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-x: hidden;
}

/* Background Animated Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.4;
    border-radius: 50%;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--color-remote);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: var(--color-leave);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 30s;
    animation-delay: -10s;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 50px) scale(1.1);
    }
}

/* Container */
.app-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    user-select: none;
    /* Empêche de surligner le texte pendant le drag */
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-absentees-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.absentees-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-absent);
    font-weight: 700;
}

.header-absentees {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    max-width: 400px;
}

.header-absentees .summary-tag {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.header-absentees .summary-empty {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
}

#current-month-display {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: capitalize;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.toggle-btn {
    padding: 6px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#user-name-display {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-avatar:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Status Picker - Floating Bar */
.status-picker {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.status-picker .status-btn {
    flex-direction: row;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.status-picker .status-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.status-picker .status-btn.active {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--status-color);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2), inset 0 0 0 1px var(--status-color);
}

.status-picker .status-btn .icon {
    font-size: 1.1rem;
}

.month-nav {
    display: flex;
    gap: 0.5rem;
}

.month-nav button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.month-nav button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card[data-type="remote"] .stat-value {
    color: var(--color-remote);
}

.stat-card[data-type="absent"] .stat-value {
    color: var(--color-absent);
}

.stat-card[data-type="office"] .stat-value {
    color: var(--color-office);
}

/* Calendar */
.calendar-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 1rem;
    text-align: center;
}

.calendar-weekdays span {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    user-select: none;
    transition: all 0.3s ease;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' style='font-size:20px'><text y='18'>🖌️</text></svg>") 0 16, auto;
}

.calendar-day {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    position: relative;
    user-select: none;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
}

.calendar-day .day-number {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.calendar-day .day-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 4px;
}

/* Status variants for days - Stronger colors */
.calendar-day[data-status="REMOTE"] {
    background: rgba(56, 189, 248, 0.25);
    border-color: rgba(56, 189, 248, 0.5);
}

.calendar-day[data-status="VACATION"] {
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.5);
}

.calendar-day[data-status="OFFICE"] {
    background: rgba(52, 211, 153, 0.25);
    border-color: rgba(52, 211, 153, 0.5);
}

.calendar-day[data-status="REMOTE"] .day-number {
    color: var(--color-remote);
}

.calendar-day[data-status="VACATION"] .day-number {
    color: var(--color-absent);
}

.calendar-day[data-status="OFFICE"] .day-number {
    color: var(--color-office);
}

.calendar-day[data-status] {
    animation: statusPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes statusPop {
    0% {
        transform: scale(0.9);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.calendar-day.today {
    border: 2px solid var(--accent);
}

/* Modal */
.status-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.status-selector-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.status-modal-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.status-modal-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

#selected-date-label {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.status-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.squad-select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.squad-select:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.squad-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.squad-tag {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.squad-tag:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.status-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.status-btn.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    transform: scale(1.02);
}

.status-btn.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-btn .icon {
    font-size: 1.5rem;
}

/* View Sections */
.view-section {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.view-section.active {
    display: flex;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Team View */
.team-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.team-header h2 {
    font-size: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.modal-actions-right {
    display: flex;
    gap: 0.75rem;
}

.team-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
}

#team-month-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.team-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.remote {
    background: var(--color-remote);
}

.dot.office {
    background: var(--color-office);
}

.dot.absent {
    background: var(--color-absent);
}

.team-today-card {
    background: rgba(251, 191, 36, 0.05);
    border: 1px solid rgba(251, 191, 36, 0.1);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.today-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.today-card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-absent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pulse-icon {
    width: 8px;
    height: 8px;
    background: var(--color-absent);
    border-radius: 50%;
    position: relative;
}

.pulse-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-absent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(3);
        opacity: 0;
    }
}

.team-absentees-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.summary-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.summary-empty {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.team-grid-container {
    overflow-x: auto;
    padding-bottom: 1rem;
}

.team-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1px;
    background: var(--glass-border);
    min-width: 800px;
}

.team-row-header,
.team-cell {
    background: var(--bg-dark);
    padding: 0.75rem;
    height: 50px;
    display: flex;
    align-items: center;
}

.team-row-header {
    font-weight: 600;
    font-size: 0.9rem;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #1e293b;
}

.team-days-header {
    display: grid;
    grid-template-columns: repeat(var(--days-count, 31), 1fr);
    background: var(--bg-dark);
}

.day-col-header {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-left: 1px solid var(--glass-border);
}

.team-user-row {
    display: contents;
}

.team-user-row:last-child {
    border-bottom: none;
}

.team-squad-header-row {
    grid-column: 1 / span 2;
    background: rgba(99, 102, 241, 0.15);
    padding: 0.75rem 1rem;
    margin: 1.5rem 0 0.5rem 0;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    display: flex;
    align-items: center;
    position: sticky;
    left: 0;
    z-index: 1;
}

.team-squad-header-row:first-of-type {
    margin-top: 0;
}

.squad-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.team-user-presence {
    display: grid;
    grid-template-columns: repeat(var(--days-count, 31), 1fr);
}

.presence-cell {
    border-left: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.presence-cell[data-status="remote"] {
    background: rgba(56, 189, 248, 0.15);
    color: var(--color-remote);
}

.presence-cell[data-status="office"] {
    background: rgba(52, 211, 153, 0.15);
    color: var(--color-office);
}

.presence-cell[data-status="absent"] {
    background: rgba(251, 191, 36, 0.15);
    color: var(--color-absent);
}

.calendar-day.is-off-day {
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.02);
}

.presence-cell.is-off-day {
    background: rgba(255, 255, 255, 0.02) !important;
}

.presence-cell.is-today {
    background: rgba(99, 102, 241, 0.1) !important;
    border-left: 1px solid var(--accent);
    border-right: 1px solid var(--accent);
}

.day-col-header.is-today {
    color: var(--accent);
    font-weight: 700;
    background: rgba(99, 102, 241, 0.15);
}

/* Modal specific */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent);
}

.status-btn.danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.status-btn.danger:hover {
    background: rgba(248, 113, 113, 0.25);
    border-color: var(--color-danger);
}

.status-btn.primary {
    background: var(--accent);
    font-weight: 600;
}

.status-btn.primary:hover {
    background: var(--accent-hover);
}

.close-btn {
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
}

.close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.02);
}

.calendar-day.weekend {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
    opacity: 0.5;
}

.calendar-day.weekend .day-number {
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .app-container {
        padding: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .calendar-day .day-number {
        font-size: 0.9rem;
    }
}