/* ============================================================
   ONGLET "7 JOURS" (#weekviewer) — vue widget hebdomadaire
   Desktop : grille de 7 cartes-colonnes. Mobile : liste verticale.
   Rendu par renderWeekView (viewer-v6.js), données fetchWidgetForecast(,,7).
   ============================================================ */

.wk-wrap { padding: 8px 4px 90px; max-width: 1250px; margin: 0 auto; }

.wk-head { display: flex; justify-content: center; margin-bottom: 10px; }
.wk-legend { font-size: 0.72rem; color: var(--c-text-muted); text-align: center; }

.wk-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.wk-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.12s ease, box-shadow 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .wk-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10); } }
.wk-card:active { transform: scale(0.97); }
/* J+5 à J+7 : fiabilité réduite (modèle longue portée) */
.wk-card.wk-far { opacity: 0.78; }

.wk-day {
    font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--c-text);
}
.wk-card:first-child .wk-day { color: var(--c-primary, #F94361); }

/* Colonne gauche : météo (icône+T°) avec les tags Pluie/CAPE/Nuages DESSOUS
   (request user 2026-09-04). */
.wk-leftcol { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.wk-meteo { display: flex; align-items: center; gap: 4px; }
.wk-icon { width: 44px; height: 44px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1)); }
.wk-temps { display: flex; flex-direction: column; line-height: 1.15; }
.wk-tmax { font-size: 0.85rem; font-weight: 800; color: var(--c-text); }
.wk-tmin { font-size: 0.75rem; font-weight: 600; color: var(--c-text-muted); }

/* Corps de carte : donuts MATIN/SOIR et tags Pluie/CAPE CÔTE À CÔTE (desktop).
   flex-wrap en secours : si la colonne tags ne tient pas, elle passe dessous. */
.wk-body { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-width: 0; flex-wrap: wrap; }
.wk-windows { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* Desktop (colonnes étroites) : chip sur 2 lignes — [MATIN ◔88] puis vent dessous */
.wk-win {
    display: grid; grid-template-columns: auto auto; justify-content: center;
    align-items: center; column-gap: 4px; row-gap: 1px;
}
/* Label heure du créneau (ex-MATIN/SOIR) — format 0xH/xxH padé, chiffres
   tabulaires + largeur mini pour un alignement vertical entre cartes. */
.wk-win-lbl {
    font-size: .6875rem; font-weight: 500; text-transform: uppercase;
    letter-spacing: 0.3px; color: var(--c-text-muted); flex-shrink: 0;
    font-variant-numeric: tabular-nums; font-feature-settings: 'tnum';
    min-width: 26px; text-align: right;
}
/* Mini-donut FlyScore (design widgets accueil) */
.wk-donut { display: block; flex-shrink: 0; width: 26px; height: 26px; }
.wk-donut-track { stroke: #ECECEE; }
body.dark-mode .wk-donut-track { stroke: rgba(255, 255, 255, 0.14); }
.wk-donut-nd {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; font-size: 0.72rem; font-weight: 700;
    color: var(--c-text-muted);
}
/* Bloc vent design Timeline : flèche colorée par axe + 2 lignes texte */
.wk-wind {
    grid-column: 1 / 3; text-align: center; min-width: 0;
}
.wk-wind-line {
    font-size: 0.72rem; font-weight: 600; color: var(--c-text);
    white-space: nowrap; line-height: 1.35;
}
.wk-wind-line small { font-size: .6875rem; font-weight: 400; opacity: 0.65; margin-left: 1px; }
.wk-wind-deg { font-weight: 400; opacity: 0.6; }
.wk-wind-gust { font-weight: 700; color: #E24B4A; margin-left: 3px; }
.wk-wind-gust small { font-size: .6875rem; font-weight: 400; opacity: 0.8; margin-left: 1px; }
.wk-wind-nd { font-size: 0.72rem; color: var(--c-text-muted); }

/* Tags pluie/CAPE/nuages — sous la météo de gauche, en ligne wrap */
.wk-foot {
    display: flex; flex-direction: row; flex-wrap: wrap; align-items: center;
    justify-content: center; gap: 3px; flex-shrink: 0; min-width: 0;
}
.wk-foot:empty { display: none; }
.wk-tag {
    display: inline-flex; align-items: center; gap: 1px;
    font-size: .6875rem; font-weight: 700; color: var(--c-text-muted);
    background: rgba(128, 128, 128, 0.10); padding: 1px 3px; border-radius: 6px;
    white-space: nowrap;
}
.wk-tag svg { width: 8px; height: 8px; }
.wk-tag svg { flex-shrink: 0; display: block; }
.wk-tag.wk-bad { color: #c0392b; background: rgba(192, 57, 43, 0.12); }

.wk-note {
    margin-top: 12px; text-align: center;
    font-size: .6875rem; color: var(--c-text-muted); opacity: 0.8;
}

/* ── Loader / erreur ── */
.wk-loading {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 60px 20px; color: var(--c-text-muted); font-size: 0.85rem;
}
.wk-spinner {
    width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid var(--c-border); border-top-color: var(--c-primary, #F94361);
    animation: wk-spin 0.8s linear infinite;
}
@keyframes wk-spin { to { transform: rotate(360deg); } }
.wk-error { padding: 50px 20px; text-align: center; color: var(--c-text-muted); font-size: 0.85rem; }

/* ── Dark mode ── */
body.dark-mode .wk-card { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
body.dark-mode .wk-tag { background: rgba(255, 255, 255, 0.08); }
body.dark-mode .wk-tag.wk-bad { color: #ff8a80; background: rgba(255, 82, 82, 0.15); }

/* ── Tablette / desktop étroit : la grille passe en wrap 4+3 ── */
@media (max-width: 1100px) and (min-width: 769px) {
    .wk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Mobile : liste verticale de rangées widget ──
   (+ tablette portrait, même condition que les autres fichiers CSS) */
@media (max-width: 768px), (pointer: coarse) and (max-width: 999px) {
    .wk-wrap { padding: 6px 8px 110px; }
    .wk-grid { grid-template-columns: 1fr; gap: 8px; }

    .wk-card {
        flex-direction: row; align-items: center;
        padding: 8px 10px; gap: 8px;
    }
    .wk-day { width: 44px; flex-shrink: 0; text-align: center; font-size: .6875rem; }
    .wk-leftcol { flex-shrink: 0; }
    .wk-meteo { flex-shrink: 0; }
    .wk-icon { width: 38px; height: 38px; }
    /* Mobile (rangées larges) : bloc [scores + vent] CENTRÉ dans l'espace
       restant (request user 2026-09-04). */
    .wk-body { flex: 1; width: auto; justify-content: center; gap: 8px; }
    .wk-windows { flex: 0 1 auto; gap: 6px; }
    /* Colonne vent en largeur FIXE : la largeur du bloc ne dépend pas du texte
       vent le plus long → donuts alignés entre cartes (request user). */
    /* Heures à la MÊME taille que le secteur vent (request user 2026-09-05),
       vent sur 1 ligne calée à gauche — FlyScore inchangé. */
    .wk-win { grid-template-columns: 40px auto 68px; justify-content: flex-start; column-gap: 4px; align-items: center; }
    .wk-win-lbl { font-size: 0.8rem; }
    .wk-win .wk-donut, .wk-win .wk-donut-nd { width: 36px; height: 36px; }
    .wk-wind { grid-column: auto; text-align: left; }
    .wk-wind-line { font-size: 0.8rem; }

    /* Bord à bord avec séparateur, comme le Fil Logbook (request user 2026-10-23) :
       les cartes perdent cadre/ombre/rayon, un filet sépare les jours, fond plein. */
    .wk-wrap { padding: 0 0 110px; }
    .wk-grid { gap: 0; background: var(--c-surface); }
    .wk-card {
        border: 0; border-radius: 0; box-shadow: none; background: transparent;
        padding: 12px 14px; border-bottom: 1px solid var(--c-border);
    }
    .wk-card:last-child { border-bottom: 0; }
    .wk-card:active { transform: none; background: rgba(128, 128, 128, 0.06); }
    body.dark-mode .wk-card { box-shadow: none; }
    .wk-head { margin: 0; padding: 8px 14px; }

    /* Bottom bar : 6 onglets (7J + Timeline + Simu + Data + Graph + Radar)
       → boutons compactés pour tenir bord à bord */
    .ios-toolbar-wrapper .ios-bubble.main button { padding: 8px 4px !important; }
    .ios-toolbar-wrapper .ios-bubble.main .tab-label { font-size: .6875rem !important; letter-spacing: 0.02em; }
}

/* Très petits écrans : icône seule sur les onglets inactifs (style widget iOS) */
@media (max-width: 360px) {
    .ios-toolbar-wrapper .ios-bubble.main button:not(.active) .tab-label { display: none !important; }
}
