/* ============================================
   Fast2 — Sessions Calendar
   ============================================ */

/* ── Legend ── */
.cal-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--sp-md);
    padding: var(--sp-md) var(--sp-lg);
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    margin-bottom: var(--sp-lg);
}

.cal-legend__levels {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    flex-wrap: wrap;
}

.cal-legend__item {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-xs);
    font-size: var(--fs-small);
    color: var(--c-text);
    white-space: nowrap;
}

.cal-legend__dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.cal-legend__dot--debutant      { background: var(--c-level-debutant); }
.cal-legend__dot--intermediaire  { background: var(--c-level-intermediaire); }
.cal-legend__dot--avance         { background: var(--c-level-avance); }
.cal-legend__dot--expert         { background: var(--c-level-expert); }

.cal-legend__separator {
    width: 1px;
    height: 20px;
    background: var(--c-border);
}

.cal-legend__registration {
    display: flex;
    align-items: center;
}

.cal-legend__swatch {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.cal-legend__swatch--registered {
    background: var(--c-primary-50);
    border: 2px solid var(--c-primary);
}

/* ── Month navigation ── */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-lg);
    margin-bottom: var(--sp-lg);
}

.cal-nav__title {
    font-family: var(--ff-display);
    font-size: var(--fs-h3);
    font-weight: var(--fw-bold);
    color: var(--c-dark);
    min-width: 240px;
    text-align: center;
}

.cal-nav__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-full);
    background: var(--c-white);
    color: var(--c-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cal-nav__btn:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
    background: var(--c-primary-50);
}

/* ── Calendar grid (desktop) ── */
.cal-grid {
    display: none;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--c-white);
}

.cal-grid__header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--c-dark);
}

.cal-grid__day-name {
    padding: var(--sp-sm) var(--sp-xs);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.cal-grid__body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-grid__cell {
    min-height: 120px;
    border-right: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
    padding: var(--sp-xs);
    position: relative;
    background: var(--c-white);
}

.cal-grid__cell:nth-child(7n) {
    border-right: none;
}

.cal-grid__cell--outside {
    background: var(--c-light);
    opacity: 0.5;
}

.cal-grid__cell--today {
    background: #FFFBEB;
}

.cal-grid__cell--today .cal-grid__date {
    background: var(--c-primary);
    color: var(--c-white);
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-grid__date {
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    color: var(--c-text-light);
    margin-bottom: var(--sp-2xs);
    display: inline-block;
    padding: 2px;
}

.cal-grid__sessions {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* ── Session card (inside calendar cell) ── */
.cal-session {
    display: block;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    font-size: var(--fs-xs);
    text-decoration: none;
    color: var(--c-text);
    transition: all var(--transition-fast);
    background: var(--c-light);
    line-height: 1.3;
    cursor: pointer;
}

.cal-session:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
    color: var(--c-text);
}

/* Level colors (left border) */
.cal-session--debutant       { border-left-color: var(--c-level-debutant); }
.cal-session--intermediaire  { border-left-color: var(--c-level-intermediaire); }
.cal-session--avance         { border-left-color: var(--c-level-avance); }
.cal-session--expert         { border-left-color: var(--c-level-expert); }

/* Registered state */
.cal-session--registered {
    background: var(--c-primary-50);
    border-right: 2px solid var(--c-primary);
}

.cal-session__time {
    font-weight: var(--fw-semibold);
    color: var(--c-dark);
    margin-right: 4px;
}

.cal-session__title {
    display: block;
    font-weight: var(--fw-medium);
    color: var(--c-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-session__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
    gap: var(--sp-xs);
}

.cal-session__places {
    color: var(--c-text-light);
    font-size: 0.65rem;
}

.cal-session__badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    font-size: 0.6rem;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cal-session__badge--debutant      { background: #ECFDF5; color: #065F46; }
.cal-session__badge--intermediaire { background: #EFF6FF; color: #1E40AF; }
.cal-session__badge--avance        { background: #FFFBEB; color: #92400E; }
.cal-session__badge--expert        { background: #FEF2F2; color: #991B1B; }

.cal-session__check {
    color: var(--c-primary);
    font-size: var(--fs-xs);
    flex-shrink: 0;
}

/* ── Empty day state ── */
.cal-grid__empty {
    text-align: center;
    padding: var(--sp-2xl) var(--sp-md);
    color: var(--c-text-light);
    font-size: var(--fs-small);
    grid-column: 1 / -1;
}

/* ── Mobile list view ── */
.cal-list {
    display: block;
}

.cal-list__empty {
    text-align: center;
    padding: var(--sp-2xl) var(--sp-md);
    color: var(--c-text-light);
    font-size: var(--fs-body);
}

.cal-list__day {
    margin-bottom: var(--sp-md);
}

.cal-list__day-header {
    font-family: var(--ff-display);
    font-size: var(--fs-small);
    font-weight: var(--fw-bold);
    color: var(--c-dark);
    padding: var(--sp-xs) 0;
    border-bottom: 2px solid var(--c-border);
    margin-bottom: var(--sp-sm);
}

.cal-list__day-header--today {
    border-bottom-color: var(--c-primary);
    color: var(--c-primary);
}

.cal-list-session {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    padding: var(--sp-md);
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-left: 4px solid transparent;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--c-text);
    transition: all var(--transition-fast);
    margin-bottom: var(--sp-sm);
}

.cal-list-session:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--c-text);
}

/* Level borders */
.cal-list-session--debutant       { border-left-color: var(--c-level-debutant); }
.cal-list-session--intermediaire  { border-left-color: var(--c-level-intermediaire); }
.cal-list-session--avance         { border-left-color: var(--c-level-avance); }
.cal-list-session--expert         { border-left-color: var(--c-level-expert); }

/* Registered state (mobile) */
.cal-list-session--registered {
    background: var(--c-primary-50);
    border-right: 3px solid var(--c-primary);
}

.cal-list-session__time {
    font-family: var(--ff-mono);
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    color: var(--c-dark);
    min-width: 50px;
    flex-shrink: 0;
}

.cal-list-session__content {
    flex: 1;
    min-width: 0;
}

.cal-list-session__title {
    font-weight: var(--fw-semibold);
    font-size: var(--fs-body);
    color: var(--c-dark);
    margin-bottom: 2px;
}

.cal-list-session__details {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-size: var(--fs-xs);
    color: var(--c-text-light);
}

.cal-list-session__check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-primary);
}

/* ── Responsive ── */
@media (min-width: 1024px) {
    .cal-grid {
        display: block;
    }
    .cal-list {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .cal-grid {
        display: block;
    }
    .cal-list {
        display: none;
    }
    .cal-grid__cell {
        min-height: 100px;
    }
    .cal-session__title {
        font-size: 0.65rem;
    }
}

@media (max-width: 767px) {
    .cal-grid {
        display: none !important;
    }
    .cal-list {
        display: block !important;
    }
    .cal-nav__title {
        font-size: var(--fs-h4);
        min-width: 180px;
    }
    .cal-legend {
        flex-direction: column;
        gap: var(--sp-sm);
    }
    .cal-legend__levels {
        justify-content: center;
    }
    .cal-legend__separator {
        width: 80%;
        height: 1px;
    }
}
