/* ============================================================
   DASHBOARD METEO - V1
   ============================================================ */

:root {
    --bg: #eef3f8;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --text: #263746;
    --muted: #718096;
    --primary: #3f73b8;
    --primary-dark: #315f9c;
    --border: #e2e8f0;
    --shadow: 0 8px 24px rgba(38, 55, 70, 0.08);
    --sidebar: #243b53;
    --sidebar-text: #dce7f2;
    --sidebar-muted: #9fb2c5;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.site {
    width: min(1500px, calc(100% - 28px));
    margin: 14px auto;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(38, 55, 70, 0.12);
    overflow: hidden;
}

/* HEADER / BANNIÈRE */

.weather-masthead {
    position: relative;
    width: 100%;
    margin: 0;
    overflow: hidden;
    background: #dbe7f2;
    line-height: 0;
}

/* La bannière occupe toujours toute la largeur disponible.
   Son ratio 1300x150 est conservé. */
.weather-masthead-banner {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
}

/* Le bandeau MétéoSuisse suit exactement la largeur de la bannière. */
.meteosuisse-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    width: 100%;
    background: transparent;
    line-height: normal;
}

.meteosuisse-overlay iframe {
    display: block;
    width: 100%;
    max-width: none;
    border: 0;
    background: transparent;
}

.station-topbar {
    min-height: 52px;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.station-topbar-brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.station-topbar-title {
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
}

.station-topbar-subtitle {
    color: var(--muted);
    font-size: 11px;
}

.station-topbar-status {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f0ad4e;
    box-shadow: 0 0 0 4px rgba(240, 173, 78, 0.12);
}

.status-dot.online {
    background: #42a96b;
    box-shadow: 0 0 0 4px rgba(66, 169, 107, 0.12);
}

.status-dot.offline {
    background: #d9534f;
    box-shadow: 0 0 0 4px rgba(217, 83, 79, 0.12);
}

.header-time {
    padding-left: 8px;
    font-weight: 700;
    color: var(--text);
}

/* LAYOUT */

.site-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    min-height: 900px;
}

.sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    color: var(--sidebar-text);
}

.main-nav {
    padding: 20px 12px;
}

.nav-section {
    margin: 22px 10px 8px;
    color: var(--sidebar-muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--sidebar-text);
    transition: background .15s ease, transform .15s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,.08);
    transform: translateX(2px);
}

.nav-item.active {
    background: rgba(255,255,255,.13);
    font-weight: 700;
}

.nav-icon {
    width: 23px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px;
    color: var(--sidebar-muted);
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 11px;
    line-height: 1.6;
}

.station-name {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

/* CONTENT */

.content {
    min-width: 0;
    padding: 30px;
    background: var(--bg);
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--primary);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 5px 0 0;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 30px;
}

h2 {
    font-size: 22px;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.last-update {
    flex: 0 0 auto;
    padding: 10px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: right;
}

.last-update span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .8px;
}

.last-update strong {
    display: block;
    margin-top: 3px;
    font-size: 16px;
}

/* WEATHER CARDS */

.weather-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 18px;
}

.weather-card {
    min-width: 0;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
    cursor: pointer;
}

.weather-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(38, 55, 70, .13);
}

.card-head {
    min-height: 43px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.card-label {
    display: block;
    font-size: 15px;
    font-weight: 750;
}

.card-description {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.card-icon {
    font-size: 20px;
    opacity: .75;
}

.gauge-wrap {
    height: 260px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    overflow: visible;
}

.gauge-wrap canvas {
    display: block;
    width: min(250px, 100%);
    height: auto;
}

.card-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}

.card-value strong {
    font-size: 29px;
    line-height: 1;
    letter-spacing: -1px;
}

.card-value span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 11px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

.card-bottom strong {
    color: var(--text);
    font-size: 11px;
}

/* QUICK STATS */

.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.quick-stat {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.quick-icon {
    font-size: 19px;
}

.quick-stat span:not(.quick-icon) {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.quick-stat strong {
    display: block;
    margin-top: 2px;
    font-size: 13px;
}

/* SECTIONS */

.section-block {
    margin-top: 32px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 14px;
}

.section-note {
    color: var(--muted);
    font-size: 11px;
}

/* CAMERAS */

.camera-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.camera-card {
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.camera-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 7px 10px;
    font-size: 14px;
}

.camera-card img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    background: #dce3ea;
}

/* FOOTER */

.site-footer {
    min-height: 54px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 11px;
}

/* RESPONSIVE */








/* Ajustements spécifiques bannière + MétéoSuisse */





/* Header : adaptation parfaite à la largeur du site */
.site > .weather-masthead {
    width: 100%;
    max-width: none;
}

/* Si bandeau_meteosuisse.php contient lui-même un conteneur limité,
   on force les éléments directs à utiliser toute la largeur disponible. */
.meteosuisse-overlay > * {
    width: 100% !important;
    max-width: none !important;
}

/* Sur grands écrans, on garde le ratio naturel de la bannière. */


/* Sur tablette/téléphone, on privilégie la lisibilité :
   légère hauteur minimale et recadrage horizontal si nécessaire. */





/*
 * Certains navigateurs mobiles peuvent exposer un viewport CSS proche
 * de 980 px (notamment en mode "site pour ordinateur").
 * On bascule donc le layout mobile jusqu'à 1050 px.
 */


/* Téléphone vertical */


/* Très petits écrans */







/* En dessous de 350 px seulement, retour à 1 colonne */



/* ============================================================
   V3.5 — LAYOUT UNIQUE ORDINATEUR
   ============================================================ */

html,
body {
    min-width: 1300px;
}

body {
    overflow-x: auto;
}

.site {
    width: 1300px;
    max-width: 1300px;
    margin: 14px auto;
    border-radius: 20px;
    overflow: hidden;
}

.weather-masthead {
    width: 1300px;
    max-width: 1300px;
    height: 150px;
    min-height: 150px;
}

.weather-masthead-banner {
    width: 1300px;
    max-width: 1300px;
    height: 150px;
    min-height: 150px;
    object-fit: cover;
}

.meteosuisse-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 1300px;
    height: 55px;
    overflow: hidden;
}

.meteosuisse-overlay > * {
    width: 100% !important;
    max-width: 100% !important;
}

.station-topbar {
    width: 1300px;
}

.site-layout {
    display: grid;
    grid-template-columns: 190px 1110px;
}

.sidebar {
    width: 190px;
}

.content {
    width: 1110px;
    min-width: 1110px;
    padding: 30px;
}

.weather-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-stats {
    grid-template-columns: repeat(4, 1fr);
}

.camera-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Les gauges gardent leur taille desktop. */
.gauge-wrap {
    height: 260px;
}

.gauge-wrap canvas {
    width: 250px !important;
    max-width: none !important;
    height: auto !important;
}


/* ============================================================
   V3.7 — SPARKLINES 24 H (test Temp / Humidité / Pression)
   ============================================================ */

.sparkline-block {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.sparkline {
    display: block;
    width: 100%;
    height: 52px;
}

.sparkline-caption {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
    text-align: center;
    letter-spacing: .2px;
}


/* V3.8 — SPARKLINES : TOOLTIP + MIN/MAX */
.sparkline-block { position: relative; }
.sparkline { cursor: crosshair; }

.sparkline-extremes {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
    font-size: 9px;
    color: var(--muted);
}
.sparkline-extremes strong { color: var(--text); font-weight: 750; }

.sparkline-tooltip {
    position: fixed;
    z-index: 99999;
    display: none;
    min-width: 100px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(38,55,70,.96);
    color: #fff;
    font-size: 11px;
    line-height: 1.25;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.sparkline-tooltip-title { display:block; font-weight:800; margin-bottom:2px; }
.sparkline-tooltip-time { display:block; opacity:.72; font-size:9px; margin-top:2px; }


/* V3.9 — harmonisation de toutes les sparklines */
.weather-card .sparkline-block {
    min-height: 82px;
}

.weather-card .sparkline-extremes {
    padding: 0 2px;
}


/* ============================================================
   V4.0 — GRAPHIQUE DÉTAILLÉ EN MODALE
   ============================================================ */

.weather-card {
    position: relative;
}

.weather-card::after {
    content: "↗";
    position: absolute;
    right: 14px;
    bottom: 12px;
    color: var(--muted);
    font-size: 11px;
    opacity: .45;
}

.graph-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.graph-modal.open {
    display: flex;
}

.graph-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(25, 40, 55, .62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.graph-dialog {
    position: relative;
    z-index: 1;
    width: min(1050px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0,0,0,.30);
    padding: 22px;
}

.graph-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.graph-dialog-header h2 {
    margin-top: 3px;
    font-size: 25px;
}

.graph-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.graph-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
}

.graph-close:hover {
    background: var(--bg);
}

.graph-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 16px 0 13px;
}

.graph-range {
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.graph-range:hover,
.graph-range.active {
    border-color: var(--primary);
    background: #eaf1fa;
    color: var(--primary-dark);
}

.graph-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.graph-summary > div {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.graph-summary span {
    display: block;
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.graph-summary strong {
    display: block;
    margin-top: 3px;
    font-size: 15px;
}

.detail-chart {
    width: 100%;
    height: 470px;
}

.graph-loading {
    display: none;
    padding: 14px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.graph-loading.visible {
    display: block;
}

body.graph-open {
    overflow: hidden;
}
