/* ===================================================================
 * combien-de-semaines.css
 * Styles dédiés à l'outil tri-mode (année / mois / semaine actuelle).
 * Inspiré du quantas-semanas-tem.css du CDP, adapté à la palette FR
 * et au composant qst-card (gradient, watermark) déjà utilisé dans
 * d'autres outils de joursouvrables.fr.
 *
 * Structure :
 *  1. Hero spotlight (qst-spotlight, deux colonnes)
 *  2. Microcards (qst-card, 6 par mode)
 *  3. Calendrier annuel (.month-container + .qst-cal-row + .qst-wk-cell)
 *  4. Tables (qst-iso-table, qst-history)
 *  5. Section headers (qst-section-head)
 *  6. Print + screen-reader utilitaires
 * =================================================================== */

/* ─── 1. Hero spotlight (deux colonnes : grand chiffre + cartes) ──── */
/* Audit 2026-05-07 (bump 57) : max-width 1160px restauré. Le vrai fix de l'alignement
 * est structurel (qst-spotlight DENTRO de cdp-tool-shift--article wrapper, pattern
 * de jour-ouvre-rang.php) — bumps 55/56 tentaram CSS mas o problema era markup.
 * Quando dentro de cdp-tool-shift--article (body 1000px), qst-spotlight é constrained
 * pelo parent wrapper. Quando dentro de cdp-tool-shift--qst (body 1160px,
 * combien-de-semaines-dans-une-annee), qst-spotlight ocupa todo o espaço. */
.qst-spotlight {
    width: auto;
    max-width: 1160px;
    margin: 16px auto 24px;
    padding: 28px 30px;
    border-radius: 16px;
    color: #ffffff;
    background:
        radial-gradient(900px 380px at 90% -10%, rgba(255,255,255,0.10) 0, transparent 55%),
        radial-gradient(700px 300px at 0% 110%, rgba(255,255,255,0.06) 0, transparent 55%),
        linear-gradient(135deg, #0a3d8f 0%, #062760 100%);
    box-shadow: 0 4px 22px rgba(15, 23, 42, 0.10);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}
.qst-spotlight--current-week {
    background:
        radial-gradient(900px 380px at 90% -10%, rgba(255,255,255,0.12) 0, transparent 55%),
        linear-gradient(135deg, #1d4ed8 0%, #581c87 60%, #9d174d 100%);
}
.qst-spotlight--month {
    background:
        radial-gradient(900px 380px at 90% -10%, rgba(255,255,255,0.10) 0, transparent 55%),
        linear-gradient(135deg, #0e7490 0%, #134e4a 100%);
}
.qst-spotlight__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
    gap: 36px;
    align-items: center;
}

/* Audit Phase 2 (2026-05-07) : .qst-spotlight--with-head + descendants supprimes
 * orphans depuis bump 53/57 (handlers usam cal-year-hero + qst-spotlight separes).
 * Verified zero handler PHP usage via Grep. */
.qst-spotlight__left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}
.qst-spotlight__label {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.86);
    letter-spacing: 0.01em;
}
.qst-spotlight__big {
    margin: 0;
    font-size: clamp(4rem, 9vw, 7rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #ffffff;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.18);
}
.qst-spotlight--current-week .qst-spotlight__big {
    background: linear-gradient(135deg, #fef9c3 0%, #fde68a 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.qst-spotlight__extra {
    margin: 6px 0 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}
.qst-spotlight__right-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
}
.qst-spotlight__right-title i { font-size: 1rem; opacity: 0.9; }

/* ─── 2. Microcards qst-card (gradient + watermark + couleur) ─────── */
.qst-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.qst-card {
    --card-accent: #0071e3;
    --card-accent-soft: rgba(0, 113, 227, 0.05);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background:
        radial-gradient(ellipse 120% 90% at 100% 0%, var(--card-accent-soft), transparent 70%),
        rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    text-align: left;
    color: #0f172a;
}
.qst-card:hover {
    transform: translateY(-2px);
    border-color: var(--card-accent);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 14px 30px -12px color-mix(in srgb, var(--card-accent) 35%, transparent);
}
.qst-card__head,
.qst-card__value,
.qst-card__meta {
    position: relative;
    z-index: 1;
    margin: 0;
}
.qst-card__head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--card-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.qst-card__head i { font-size: 0.78rem; }
.qst-card__value {
    font-size: 1.85rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-top: 2px;
}
.qst-card__value--small {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.005em;
}
.qst-card__meta {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}
.qst-card__watermark {
    position: absolute;
    right: -10px;
    bottom: -18px;
    font-size: 88px;
    color: var(--card-accent);
    opacity: 0.07;
    pointer-events: none;
    transform: rotate(-8deg);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.qst-card:hover .qst-card__watermark {
    opacity: 0.11;
    transform: rotate(-4deg) scale(1.04);
}
.qst-card--blue   { --card-accent: #0071e3; --card-accent-soft: rgba(0, 113, 227, 0.05); }
.qst-card--cyan   { --card-accent: #0891b2; --card-accent-soft: rgba(8, 145, 178, 0.06); }
.qst-card--violet { --card-accent: #7c3aed; --card-accent-soft: rgba(124, 58, 237, 0.06); }
.qst-card--rose   { --card-accent: #e11d48; --card-accent-soft: rgba(225, 29, 72, 0.06); }
.qst-card--amber  { --card-accent: #d97706; --card-accent-soft: rgba(217, 119, 6, 0.07); }
.qst-card--green  { --card-accent: #059669; --card-accent-soft: rgba(5, 150, 105, 0.06); }

/* Cartes à l'intérieur du spotlight (fond foncé, texte clair) */
.qst-spotlight__cards .qst-card {
    background:
        radial-gradient(ellipse 120% 90% at 100% 0%, rgba(255,255,255,0.06), transparent 70%),
        rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #f8fafc;
}
.qst-spotlight__cards .qst-card__head {
    color: rgba(255, 255, 255, 0.88);
}
.qst-spotlight__cards .qst-card__value {
    color: #ffffff;
}
.qst-spotlight__cards .qst-card__meta {
    color: rgba(226, 232, 240, 0.85);
}
.qst-spotlight__cards .qst-card__watermark {
    color: #ffffff;
    opacity: 0.10;
}
.qst-spotlight__cards .qst-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

@media (max-width: 768px) {
    .qst-spotlight {
        padding: 22px 18px;
    }
    .qst-spotlight__inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .qst-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ─── 3. Section headers ─────────────────────────────────────────── */
.qst-section-head {
    margin: 10px 0 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
}
.qst-section-head h2,
.qst-section-head h3 {
    font-size: 1.4rem;
    color: var(--text-color, #0f172a);
    margin: 0 0 4px;
}
.qst-section-head p {
    margin: 0;
    color: var(--secondary-color, #64748b);
    font-size: 0.9rem;
}
.qst-section-head p em {
    font-style: normal;
    background: var(--light-bg, #f1f5f9);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--primary-color, #0071e3);
    font-weight: 700;
}

/* ─── 4. Calendrier annuel (12 mini-mois) ────────────────────────── */
/* Bump 26.8.0.4 : refonte du mini-mois (visuel table-flex avec colonne semaine,
   lignes zebrees, pilule de semaine bleue). Le markup PHP utilise maintenant
   .month-container / .qst-cal-row / .qst-wk-cell, qui herite de .calendar-day,
   .month-title, .calendar-header-day, .month-holiday-list-screen depuis
   calendrier.css (deja charge). Ce bloc ajoute uniquement les regles specifiques
   a la disposition table-flex avec colonne semaine ISO. */

/* Grille annuelle : 3 colonnes (default) → 2 (sous 900px) → 1 (sous 600px). */
.qst-annual-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 8px;
}
@media (max-width: 900px) { .qst-annual-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .qst-annual-grid { grid-template-columns: 1fr; } }

/* Desactive le hover "cliquable" du calendrier annuel global (les mini-mois
   ne sont pas cliquables ici, juste informatifs). */
.qst-annual-grid .month-container.qst-no-hover,
.qst-annual-grid .month-container.qst-no-hover:hover,
.qst-annual-grid .month-container.qst-no-hover:focus {
    cursor: default;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Pilule "Sem. 1-5" dans le titre du mois. */
.qst-week-range {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--primary-color, #0071e3);
    color: #fff;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: none;
    vertical-align: middle;
}

/* Grille du mois : remplace le grid 7-col simple par flex-column de lignes,
   chaque ligne etant un sous-grid 8-col (colonne semaine + 7 jours).
   Cible uniquement les mini-mois servis par cette page. */
.qst-annual-grid .calendar-grid.qst-cal-with-weeks {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 10px;
}

.qst-cal-row {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    gap: 3px;
    padding: 3px 2px;
    align-items: stretch;
    border-radius: 6px;
    transition: background 0.15s ease;
}
@media (max-width: 480px) {
    .qst-cal-row { grid-template-columns: 44px repeat(7, 1fr); }
}

/* Lignes zebrees pour mieux distinguer les semaines. */
.qst-cal-row:nth-of-type(even) { background: rgba(0, 113, 227, 0.05); }
.qst-cal-row:hover             { background: rgba(0, 113, 227, 0.12); }
.qst-cal-row:hover .qst-wk-cell { transform: scale(1.05); }

/* Separateur tirete entre lignes pour renforcer "une semaine par ligne". */
.qst-cal-row + .qst-cal-row {
    border-top: 1px dashed rgba(0, 113, 227, 0.14);
    margin-top: 2px;
    padding-top: 5px;
}

/* En-tete de la grille (jours + colonne "Semaine"). */
.qst-cal-row--head {
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    margin-bottom: 4px;
}
.qst-cal-row--head:hover { background: transparent; }

.qst-wk-header {
    color: var(--primary-color, #0071e3);
    font-weight: 800;
    font-size: 0.72em;
    text-align: center;
    padding: 4px 2px;
    align-self: center;
    border-right: 2px solid rgba(0, 113, 227, 0.25);
    margin-right: 4px;
    letter-spacing: 0;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .qst-wk-header { font-size: 0.68em; }
    .qst-wk-cell   { font-size: 0.68em; }
}

/* Pilule de la semaine ISO (colonne gauche, fond bleu plein). */
.qst-wk-cell {
    background: var(--primary-color, #0071e3);
    color: #fff;
    border-radius: 6px;
    padding: 2px 0;
    text-align: center;
    font-weight: 700;
    font-size: 0.72em;
    line-height: 1.2;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.02em;
    transition: transform 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 113, 227, 0.25);
    border-right: 3px solid rgba(0, 113, 227, 0.45);
    margin-right: 2px;
}

/* Mise en valeur du jour courant (compatible avec .weekend / .holiday). */
.calendar-day.qst-today {
    outline: 2px solid #f59e0b;
    outline-offset: -2px;
    background-color: rgba(251, 191, 36, 0.2);
    font-weight: 800;
}

/* Espaceur quand il n'y a pas d'evenement le mois → garde la hauteur uniforme. */
.month-holiday-spacer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed transparent;
}

/* ─── 5. Tables (ISO + historique) ───────────────────────────────── */
.qst-iso-table-wrap,
.qst-history-wrap {
    overflow-x: auto;
    margin-top: 8px;
}
.qst-iso-table,
.qst-history {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 520px;
}
.qst-iso-table thead tr,
.qst-history thead tr {
    background: var(--light-bg, #f1f5f9);
    border-bottom: 2px solid var(--border-color, #e5e7eb);
}
.qst-iso-table th,
.qst-history th {
    padding: 10px 12px;
    font-weight: 700;
    color: var(--secondary-color, #64748b);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.82rem;
}
.qst-iso-table th:first-child,
.qst-history th:first-child { text-align: left; }
.qst-iso-table th.qst-iso-table__weeks { color: var(--primary-color, #0071e3); }
.qst-iso-table td,
.qst-history td {
    padding: 9px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.qst-iso-table td:first-child,
.qst-history td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-color, #0f172a);
}
.qst-iso-table td.qst-iso-table__weeks {
    font-weight: 800;
    color: var(--primary-color, #0071e3);
}
.qst-iso-table tbody tr.qst-iso-table__total {
    border-top: 2px solid var(--border-color, #e5e7eb);
    background: var(--light-bg, #f1f5f9);
    font-weight: 800;
}
.qst-iso-table tbody tr.qst-iso-table__total td { border-bottom: 0; }
.qst-iso-table tbody tr.qst-iso-table__current {
    background: rgba(0, 113, 227, 0.08);
    font-weight: 700;
}
.qst-history tr.qst-history__current {
    background: rgba(0, 113, 227, 0.08);
    font-weight: 800;
}
.qst-history tr.qst-history__current td:first-child { color: var(--primary-color, #0071e3); }

/* ─── 5b. Tableau hebdomadaire complet (52/53 lignes) ────────────── */
.qst-weekly-table-wrap { overflow-x: auto; margin-top: 16px; }
.qst-weekly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.qst-weekly-table th,
.qst-weekly-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e5e5);
}
.qst-weekly-table thead th {
    background: var(--light-bg, #f7f8fa);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 1;
}
.qst-weekly-table tr.qst-weekly-table__current {
    background: rgba(37, 99, 235, 0.08);
    font-weight: 600;
}
.qst-weekly-table tr.qst-weekly-table__current td:first-child::before {
    content: "→ ";
    color: #2563eb;
    font-weight: 800;
}
.qst-weekly-table .qst-weekly-table__num {
    width: 70px;
    font-weight: 700;
    color: #2563eb;
}
body.dark-mode .qst-weekly-table thead th { background: rgba(255,255,255,0.04); }
body.dark-mode .qst-weekly-table th,
body.dark-mode .qst-weekly-table td { border-bottom-color: rgba(255,255,255,0.08); }
body.dark-mode .qst-weekly-table tr.qst-weekly-table__current { background: rgba(96,165,250,0.12); }
/* WCAG: #2563eb sur fond noir = 4.0:1 (FAIL). #93c5fd passe ~9:1. */
body.dark-mode .qst-weekly-table tr.qst-weekly-table__current td:first-child::before {
    color: #93c5fd;
}
body.dark-mode .qst-weekly-table .qst-weekly-table__num {
    color: #93c5fd;
}

/* ─── 6. Screen-reader ───────────────────────────────────────────── */
.qst-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── 7. Print ───────────────────────────────────────────────────── */
@media print {
    .no-print { display: none !important; }
    /* Bump 26.8.0.4 : nouveaux selecteurs apres refonte (cf. bloc 4). */
    .qst-annual-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .month-container { break-inside: avoid; }
    .qst-week-range { background: #000 !important; color: #fff !important; }
    .qst-wk-cell    { background: #1e40af !important; color: #fff !important; }
}

/* ─── 8. Dark mode ───────────────────────────────────────────────── */
body.dark-mode .qst-card {
    background:
        radial-gradient(ellipse 120% 90% at 100% 0%, var(--card-accent-soft), transparent 70%),
        #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color: #e5e7eb;
}
body.dark-mode .qst-card__value { color: #f5f5f7; }
body.dark-mode .qst-card__meta  { color: #94a3b8; }

/* Bump 26.8.0.4 : dark-mode des extras semaine (les classes de base
   .month-container, .calendar-day, .month-title, .month-holiday-list-screen
   ont leur dark-mode dans calendrier.css). */
body.dark-mode .qst-cal-row:nth-of-type(even) { background: rgba(100, 177, 255, 0.06); }
body.dark-mode .qst-cal-row:hover             { background: rgba(100, 177, 255, 0.14); }
body.dark-mode .qst-cal-row + .qst-cal-row    { border-top-color: rgba(100, 177, 255, 0.18); }
body.dark-mode .qst-wk-header {
    color: #7fc3ff;
    border-right-color: rgba(100, 177, 255, 0.30);
}
body.dark-mode .qst-wk-cell {
    background: #2563eb;
    color: #fff;
    border-right-color: rgba(100, 177, 255, 0.45);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}
body.dark-mode .qst-week-range {
    background: #2563eb;
    color: #fff;
}
body.dark-mode .calendar-day.qst-today {
    outline-color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.18);
}

body.dark-mode .qst-iso-table thead tr,
body.dark-mode .qst-history thead tr { background: rgba(255, 255, 255, 0.04); }
body.dark-mode .qst-iso-table th,
body.dark-mode .qst-iso-table td,
body.dark-mode .qst-history th,
body.dark-mode .qst-history td { border-bottom-color: rgba(255, 255, 255, 0.08); }
body.dark-mode .qst-iso-table tbody tr.qst-iso-table__total {
    background: rgba(255, 255, 255, 0.04);
}
body.dark-mode .qst-iso-table tbody tr.qst-iso-table__current,
body.dark-mode .qst-history tr.qst-history__current {
    background: rgba(96, 165, 250, 0.12);
}
