/* Planning Page - Calendar Styles */

.planning-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.control-group {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
}

.control-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.control-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-bg);
}

.control-input:focus {
    outline: none;
    border-color: var(--info-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Alternants Selection */
.alternants-selection {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.alternants-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.alternants-selection-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.alternants-selection-actions {
    display: flex;
    gap: 8px;
}

.alternants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-height: 520px;
    overflow-y: auto;
    padding: 6px 4px 4px 0;
}

.alternant-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.alternant-checkbox-item:hover {
    border-color: var(--info-blue);
    transform: translateY(-2px);
}

.alternant-checkbox-item.selected {
    background: var(--primary-navy);
    border-color: var(--primary-navy);
    color: white;
}

.alternant-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.alternant-mini-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.alternant-mini-name {
    font-weight: 600;
    font-size: 13px;
    flex: 1;
}

.alternant-role-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(227, 30, 36, 0.12);
    color: #e31e24;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

/* Calendar Container */
.calendar-container {
    background: var(--primary-navy);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.calendar-header {
    display: grid;
    grid-template-columns: 1.2fr auto 0.8fr;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.calendar-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: start;
}

.calendar-header-center {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    justify-self: center;
}

.calendar-goto-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    opacity: 0.9;
    margin: 0;
    line-height: 1;
}

.calendar-goto-input {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    min-width: 180px;
    text-align: center;
    height: 40px;
}

.calendar-goto-input:focus {
    outline: none;
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.btn-add-event {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    color: var(--primary-navy);
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    height: 40px;
}

.btn-add-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.add-icon {
    width: 24px;
    height: 24px;
    background: var(--primary-navy);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.calendar-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: end;
}

.view-mode-group {
    display: flex;
    background: white;
    border-radius: 50px;
    padding: 4px;
}

.view-mode-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-mode-btn.active {
    background: var(--primary-navy);
    color: white;
}

.btn-today {
    padding: 8px 20px;
    background: white;
    color: var(--primary-navy);
    border: 1.5px solid black;
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-today:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.nav-arrow {
    width: 36px;
    height: 36px;
    background: white;
    color: var(--primary-navy);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-arrow:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Calendar Grid */
.calendar-grid-wrapper {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: auto;
    max-height: 600px;
}

.calendar-grid-wrapper.view-day {
    overflow-x: hidden;
}

.calendar-current-label {
    margin-left: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 860px) {
    .calendar-header {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .calendar-header-left,
    .calendar-header-right {
        justify-self: center;
    }

    .calendar-goto-input {
        width: 100%;
    }
}

.goto-date-inputs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.alternants-selection .alternants-grid {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.calendar-grid {
    display: flex;
    min-width: 100%;
}

/* Alternants Column */
.alternants-column {
    background: var(--light-bg);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    width: 120px;
    position: sticky;
    left: 0;
    z-index: 8;
    box-shadow: 6px 0 16px rgba(15, 23, 42, 0.08);
    transform: translateZ(0);
}

.alternants-column-header {
    height: 82px;
    background: var(--primary-navy);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.alternant-name-row {
    height: 64px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    transition: all 0.3s ease;
    cursor: pointer;
}

.alternant-name-row:hover {
    background: var(--light-bg);
}

.alternant-avatar {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.alternant-name-text {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Days Column */
.days-column {
    flex: 1;
    min-width: 0;
    background: var(--card-bg);
}

.days-header-row {
    height: 82px;
    display: flex;
    background: var(--primary-navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.day-header {
    min-width: 82px;
    width: 82px;
    flex: 0 0 82px;
    padding: 6px 6px;
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    background: var(--primary-navy);
}

.day-header-weekday {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.day-header-date {
    font-size: 16px;
    font-weight: 700;
}

.day-header-month {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.6;
}

.day-header-year {
    font-size: 9px;
    font-weight: 600;
    opacity: 0.5;
}

.day-header.weekend {
    background: #1f2a44;
}

.day-header.today {
    background: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.35);
    box-shadow: inset 0 -4px 0 rgba(239, 68, 68, 0.7);
}

.day-header.holiday {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.holiday-label {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    opacity: 0.9;
}


/* Schedule Rows */
.schedule-row {
    height: 64px;
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.schedule-cell {
    min-width: 82px;
    width: 82px;
    flex: 0 0 82px;
    padding: 4px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    gap: 2px;
    align-items: stretch;
    justify-items: stretch;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    background: var(--card-bg);
    overflow: visible;
}

.schedule-cell .cell-value {
    line-height: 1.2;
}

.schedule-cell .slot-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.12);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-cell .slot-value {
    font-weight: 600;
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-cell .slot-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--light-bg);
    font-size: 10px;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.schedule-cell .slot-block[data-note]:hover::after {
    content: attr(data-note);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.2);
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
    max-width: 280px;
    z-index: 999;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.35);
}

.schedule-cell .slot-block[data-note]:hover::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    z-index: 999;
}

.calendar-grid.view-week .day-header,
.calendar-grid.view-week .schedule-cell {
    min-width: 0;
    width: auto;
    flex: 1 1 0;
}

.calendar-grid.view-week .schedule-row {
    height: 72px;
}

.calendar-grid.view-week .days-header-row,
.calendar-grid.view-week .schedule-row {
    width: 100%;
}

.calendar-grid.view-week .alternant-name-row {
    height: 72px;
}

.calendar-grid.view-day .alternants-column-header {
    height: 86px;
}

.calendar-grid.view-day .days-header-row {
    height: 86px;
}

.calendar-grid.view-day .day-header {
    min-width: 200px;
    width: auto;
    flex: 1 1 auto;
    gap: 4px;
}

.calendar-grid.view-day .schedule-cell.today-cell {
    border: 1.5px solid rgba(239, 68, 68, 0.6);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.1);
}

.calendar-grid.view-day .day-header-weekday {
    font-size: 10px;
    letter-spacing: 0.6px;
}

.calendar-grid.view-day .day-header-date {
    font-size: 18px;
}

.calendar-grid.view-day .day-header-month,
.calendar-grid.view-day .day-header-year {
    font-size: 9px;
}

.calendar-grid.view-day .schedule-cell {
    min-width: 0;
    width: 100%;
    flex: 1 1 0;
    padding: 6px;
    font-size: 11px;
}

.calendar-grid.view-day .schedule-row {
    height: 72px;
}

.calendar-grid.view-day .alternant-name-row {
    height: 72px;
}

.calendar-grid.view-day .days-header-row,
.calendar-grid.view-day .schedule-row {
    width: 100%;
}

.calendar-grid.view-month .days-header-row {
    border-bottom: none;
}

.calendar-grid.view-month .day-header {
    border-bottom: none;
}

.calendar-grid.view-month .day-header.today {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.22) 0%, rgba(17, 24, 39, 0.95) 100%) !important;
    background-image: linear-gradient(180deg, rgba(239, 68, 68, 0.22) 0%, rgba(17, 24, 39, 0.95) 100%) !important;
    background-color: rgba(17, 24, 39, 0.95) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    box-shadow: inset 0 -4px 0 rgba(239, 68, 68, 0.7) !important;
}

/* Overtime calendar sizing */
.overtime-calendar-wrapper .alternants-column-header,
.overtime-calendar-wrapper .days-header-row {
    height: 70px;
}

.overtime-calendar-wrapper .day-header {
    min-width: 72px;
    width: 72px;
    flex: 0 0 72px;
    padding: 4px 6px;
}

.overtime-calendar-wrapper .schedule-row,
.overtime-calendar-wrapper .alternant-name-row {
    height: 56px;
}

.overtime-calendar-wrapper .schedule-cell {
    min-width: 72px;
    width: 72px;
    flex: 0 0 72px;
    padding: 3px;
    grid-template-rows: 1fr;
}

.overtime-calendar-wrapper .schedule-cell .slot-block {
    height: 100%;
    padding: 4px;
    font-size: 11px;
}

.overtime-calendar-wrapper .alternant-name-text {
    font-size: 11px;
}

.overtime-calendar-wrapper.view-week .day-header,
.overtime-calendar-wrapper.view-week .schedule-cell {
    min-width: 0;
    width: auto;
    flex: 1 1 0;
}

.overtime-calendar-wrapper.view-day .day-header,
.overtime-calendar-wrapper.view-day .schedule-cell {
    min-width: 0;
    width: auto;
    flex: 1 1 0;
}





.schedule-cell.full-slot .slot-block {
    padding: 2px 4px;
}

.schedule-cell .slot-block.full {
    grid-row: 1 / span 2;
    height: 100%;
}

.schedule-cell.full-slot {
    gap: 0;
}

.schedule-cell.full-slot .slot-block.full {
    align-self: stretch;
    justify-self: stretch;
}

.schedule-cell .slot-block.empty {
    background: transparent;
    border: 1px dashed rgba(148, 163, 184, 0.6);
}

.schedule-cell .slot-block.status-entreprise {
    background: #3b82f6;
    color: white;
    border-color: transparent;
}

.schedule-cell .slot-block.status-ecole {
    background: #22c55e;
    color: white;
    border-color: transparent;
}

.schedule-cell .slot-block.status-conge {
    background: #a855f7;
    color: white;
    border-color: transparent;
}

.schedule-cell .slot-block.status-teletravail {
    background: #06b6d4;
    color: white;
    border-color: transparent;
}

.schedule-cell .slot-block.status-deplacement {
    background: #14b8a6;
    color: white;
    border-color: transparent;
}

.schedule-cell .slot-block.status-custom {
    background: #fbbf24;
    color: #1f2937;
    border-color: transparent;
}

.schedule-cell:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.schedule-cell.today-cell {
    border: 1.5px solid rgba(239, 68, 68, 0.6);
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.1);
}

.schedule-cell.holiday-cell {
    outline: 2px dashed #f59e0b;
    outline-offset: -4px;
}

/* Status Colors matching mockup */
.status-entreprise {
    background: #3b82f6;
    color: white;
}

.status-ecole {
    background: #22c55e;
    color: white;
}

.status-conge {
    background: #a855f7;
    color: white;
}

.status-teletravail {
    background: #06b6d4;
    color: white;
}

.status-deplacement {
    background: #14b8a6;
    color: white;
}

.status-number {
    background: var(--card-bg);
    color: var(--text-secondary);
}

/* Legend */
.calendar-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 968px) {
    .calendar-grid {
        grid-template-columns: 120px 1fr;
    }

    .alternant-name-text {
        font-size: 11px;
    }

    .schedule-cell {
        font-size: 11px;
    }
}

@media (max-width: 1024px) {
    .planning-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .control-group {
        padding: 14px 16px;
    }

    .alternants-selection {
        padding: 16px;
    }

    .alternants-selection-header {
        gap: 12px;
        flex-wrap: wrap;
    }

    .alternants-selection-actions {
        gap: 6px;
    }

    .alternants-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
        gap: 10px;
    }

    .calendar-container {
        padding: 18px;
    }

    .calendar-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .calendar-header-left {
        justify-content: space-between;
    }

    .calendar-header-right {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 10px;
    }

    .view-mode-group {
        flex: 1 1 220px;
        justify-content: space-between;
    }

    .btn-today {
        flex: 0 0 auto;
    }

    .nav-arrow {
        width: 34px;
        height: 34px;
    }

    .calendar-grid-wrapper {
        max-height: 520px;
    }
}

@media (max-width: 768px) {
    .planning-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .calendar-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
        align-items: center;
    }

    .calendar-header-right {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 10px;
    }

    .alternants-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
        gap: 10px;
    }

    .calendar-container {
        padding: 16px;
    }

    .calendar-grid-wrapper {
        max-height: 520px;
    }
}

@media (max-width: 640px) {
    .calendar-grid-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .calendar-grid-wrapper.view-day {
        overflow-x: hidden;
    }
    .calendar-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .view-mode-group {
        width: 100%;
        justify-content: space-between;
    }

    .days-header-row,
    .schedule-row {
        min-width: 600px;
    }

    .calendar-grid.view-day .days-header-row,
    .calendar-grid.view-day .schedule-row {
        min-width: 0;
    }

    .calendar-grid.view-day .day-header,
    .calendar-grid.view-day .schedule-cell {
        min-width: 0;
        width: 100%;
        flex: 1 1 0;
    }

    .alternants-grid {
        max-height: 398px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .alternant-checkbox-item {
        height: 52px;
    }

    .control-group {
        padding: 12px 14px;
    }

    .control-label {
        font-size: 10px;
        letter-spacing: 0.3px;
        white-space: normal;
        line-height: 1.2;
    }
}
