/**
 * Fiche station : mise en page selon l'identité visuelle Chiffrex (kit v1, octobre 2026).
 * Jetons (--ink, --paper, --sand, --accent, polices) définis dans style.css. Classes préfixées st-.
 * Les identifiants et classes lus par main.js (#priceChart, .chart-filter, #stationMap, .btn-favorite)
 * et par les scripts de la page (#fill-advice-container, #shortageModal) sont conservés.
 */

/* ========================================
   Gabarit
   ======================================== */
.st-page {
    padding-bottom: var(--spacing-2xl);
}

.st-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
    margin-top: 8px;
}
.st-layout > * { min-width: 0; }
.st-side { position: sticky; top: 80px; }

@media (max-width: 1024px) {
    .st-layout { grid-template-columns: minmax(0, 1fr); }
    .st-side { position: static; }
}

.st-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
}
.st-panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.st-panel-head h2,
.st-panel h2 {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 6px 0 0;
}
.st-lead {
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: -6px 0 16px;
}
.st-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .st-panel { padding: 18px; border-radius: 16px; }
}

/* ========================================
   En-tête de la fiche
   ======================================== */
.st-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 24px;
    align-items: start;
    margin: 14px 0 28px;
}
.st-hero-tile {
    width: 104px;
    height: 104px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 26px;
}
.st-hero-tile img {
    width: 82px;
    height: 82px;
    object-fit: contain;
}
.st-hero-tile .st-initial {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.75rem;
    letter-spacing: -0.04em;
    color: var(--ink);
}
.st-title {
    font-family: var(--font-display);
    font-size: clamp(2.125rem, 4.6vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    margin: 10px 0 8px;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.st-title .st-point { color: var(--accent); }
.st-address {
    color: var(--text-muted);
    font-size: 1.0625rem;
    line-height: 1.45;
    margin: 0;
}
.st-address strong { color: var(--ink); font-weight: 600; }
.st-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.st-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 10px;
    background: var(--sand);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.st-tag::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--accent);
}
.st-hero-actions {
    display: flex;
    align-items: center;
    align-self: center;
    gap: 12px;
}
.st-hero-actions .btn-favorite {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: #fff;
}

@media (max-width: 820px) {
    .st-hero { grid-template-columns: auto minmax(0, 1fr); gap: 16px; }
    .st-hero-tile { width: 76px; height: 76px; border-radius: 20px; }
    .st-hero-tile img { width: 58px; height: 58px; }
    .st-hero-tile .st-initial { font-size: 2rem; }
    .st-hero-actions { grid-column: 1 / -1; }
    .st-hero-actions .btn-primary { flex: 1; }
}

/* ========================================
   Pastilles de tendance (flèche + signe + valeur : jamais la couleur seule)
   ======================================== */
.st-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 10px;
    background: var(--sand);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-muted);
}
.st-chip small {
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.st-chip .st-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}
.st-chip.up { color: #B42318; }
.st-chip.up .st-arrow { border-bottom: 8px solid currentColor; }
.st-chip.down { color: #0B6B4A; }
.st-chip.down .st-arrow { border-top: 8px solid currentColor; }
.st-chip.flat .st-bar { width: 10px; height: 2px; background: currentColor; }

/* ========================================
   Prix actuels
   ======================================== */
.st-prices { border-top: 1px solid var(--border); }
.st-price-row {
    display: grid;
    grid-template-columns: minmax(140px, 0.7fr) auto minmax(0, 2fr);
    gap: 8px 20px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.st-price-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.st-fuel {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    min-width: 0;
}
.st-fuel-dot {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 3px solid var(--ink);
    background: var(--c, #ccc);
}
.st-fuel-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.st-price {
    text-align: right;
    white-space: nowrap;
}
.st-price strong {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}
.st-price .st-unit {
    margin-left: 4px;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.st-price small {
    display: block;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}
.st-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.st-price-row .price-alert-badge { flex-shrink: 0; }

@media (max-width: 640px) {
    .st-price-row {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 14px 0;
    }
    .st-price strong { font-size: 1.875rem; }
    .st-chips { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Aucun prix récent / prix trop anciens */
.st-no-price {
    margin: 0;
    padding: 20px;
    background: var(--sand);
    border-radius: 14px;
    font-size: 0.9375rem;
    line-height: 1.5;
}
.st-no-price strong { display: block; font-family: var(--font-display); font-size: 1.0625rem; margin-bottom: 2px; }
.st-stale {
    margin: 14px 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* ========================================
   Alerte de rupture
   ======================================== */
.st-alert {
    margin-bottom: 24px;
    padding: 20px 24px;
    background: #FEF3F2;
    border: 1px solid #FDDAD6;
    border-radius: 20px;
    color: #7A271A;
}
.st-alert h2 {
    margin: 0 0 12px;
    font-size: 1.0625rem;
    color: #B42318;
}
.st-alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.st-alert-item {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #FDDAD6;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.st-alert-item strong { font-family: var(--font-display); font-size: 1.0625rem; color: #B42318; }
.st-alert-item span { font-size: 0.8125rem; }
.st-alert-item small { font-size: 0.75rem; color: var(--text-muted); }
.st-alert p {
    margin: 12px 0 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: #912018;
}

/* ========================================
   Prévisions : tableau J+3 / J+7 / J+14
   ======================================== */
.st-fc-table { border-top: 1px solid var(--border); }
.st-fc-row {
    display: grid;
    grid-template-columns: minmax(110px, 1.1fr) repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.st-fc-row.head {
    padding: 10px 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.st-fc-row:last-child { border-bottom: 0; }
.st-fc-fuel {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.st-fc-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.st-fc-price {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.st-fc-cell .st-chip { padding: 3px 8px; font-size: 0.75rem; }
.st-conf {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
    background: var(--text-muted);
    vertical-align: middle;
}
.st-conf.high { background: #0B6B4A; }
.st-conf.medium { background: var(--accent); }
.st-conf.low { background: #B42318; }
.st-lock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.st-lock svg { width: 13px; height: 13px; }

.st-note {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--sand);
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.5;
}
.st-note strong { display: block; margin-bottom: 4px; }
.st-note a { font-weight: 700; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.st-foot {
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.st-foot a { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 640px) {
    .st-fc-row { grid-template-columns: minmax(72px, 0.9fr) repeat(3, minmax(0, 1fr)); gap: 6px; }
    .st-fc-row.head { font-size: 0.625rem; letter-spacing: 0.02em; }
    .st-lock-text { display: none; }
    .st-fc-fuel { font-size: 0.875rem; gap: 6px; }
    .st-fc-fuel .st-fuel-dot { width: 14px; height: 14px; border-width: 2px; }
    .st-fc-price { font-size: 0.9375rem; }
    .st-fc-cell .st-chip { font-size: 0.6875rem; padding: 2px 6px; gap: 4px; }
}

/* ========================================
   Widget « Faut-il faire le plein ? » (rendu par le script de la page)
   ======================================== */
.fill-advice-wrapper {
    margin-bottom: 24px;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
}
.fill-advice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.fill-advice-title {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.tank-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--paper);
}
.tank-selector select {
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    outline: none;
}
.advice-main {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 16px;
}
.advice-main.type-fill_now { background: #FEF3F2; border: 1px solid #FDDAD6; color: #7A271A; }
.advice-main.type-wait { background: #ECFDF3; border: 1px solid #ABEFC6; color: #054F31; }
.advice-main.type-none { background: var(--sand); border: 1px solid var(--border); color: var(--ink); }
.advice-emoji {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    line-height: 1;
    background: #fff;
    border-radius: 16px;
}
.advice-content { flex: 1; min-width: 0; }
.advice-label {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.advice-savings {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.75);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
}
.premium-insights {
    margin-top: 16px;
    padding: 16px 18px;
    background: var(--sand);
    border-left: 4px solid var(--accent);
    border-radius: 0 14px 14px 0;
}
.premium-insights h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 1rem;
}
.premium-insights p { margin: 0 0 12px; font-size: 0.875rem; line-height: 1.5; }
.premium-oil-impact {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 10px;
    background: #fff;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
}
.premium-upsell {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--sand);
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.premium-upsell a { font-weight: 700; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.advice-skeleton {
    height: 120px;
    border-radius: 16px;
    background: var(--sand);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@media (max-width: 640px) {
    .fill-advice-wrapper { padding: 18px; border-radius: 16px; }
    .advice-main { align-items: flex-start; padding: 14px; }
    .advice-emoji { width: 44px; height: 44px; font-size: 1.375rem; border-radius: 12px; }
}

/* ========================================
   Articles liés
   ======================================== */
.st-articles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.st-article {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.st-article time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.st-article h3 {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 0;
}
.st-article h3 a { color: var(--ink); }
.st-article h3 a:hover { text-decoration: underline; }
.st-article p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.st-link {
    margin-top: auto;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.st-link:hover { color: var(--chiffrex-blue); }
@media (max-width: 720px) {
    .st-articles { grid-template-columns: minmax(0, 1fr); }
}

/* ========================================
   Graphique (le script de main.js cible #priceChart et .chart-filter)
   ======================================== */
.st-panel .chart-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.st-panel .chart-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.st-panel .chart-wrapper { height: 320px; position: relative; }
.st-panel .chart-filter { display: inline-flex; align-items: center; gap: 6px; }
.st-panel .premium-lock { width: 12px; height: 12px; }

/* ========================================
   Informations pratiques
   ======================================== */
.st-info { display: grid; gap: 24px; }
.st-info h3 {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
}
.st-hours {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0 28px;
    margin: 0;
}
.st-hours > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}
.st-hours dt { font-weight: 600; }
.st-hours dd { margin: 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text-muted); text-align: right; }
.st-services { display: flex; flex-wrap: wrap; gap: 8px; }
.st-service {
    padding: 7px 12px;
    border-radius: 10px;
    background: var(--sand);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ========================================
   Colonne latérale
   ======================================== */
.st-side .st-panel { padding: 20px; }
.st-side h2 {
    font-size: 1.125rem;
}
.st-photo {
    margin: 0 0 20px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.st-photo img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.st-side .map-container {
    height: 260px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.st-near { list-style: none; margin: 0; padding: 0; }
.st-near li { border-top: 1px solid var(--border); }
.st-near a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 12px 0;
    color: var(--ink);
}
.st-near a:hover .st-near-name { text-decoration: underline; }
.st-near-name { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
.st-near-dist { grid-row: 1; grid-column: 2; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); align-self: center; }
.st-near-addr { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--text-muted); line-height: 1.4; }

.st-community { display: grid; gap: 10px; }
.st-community .btn { width: 100%; }
.st-btn-danger { border-color: #FDA29B; color: #B42318; }
.st-btn-danger:hover { background: #FEF3F2; border-color: #B42318; color: #B42318; }
.st-reports { margin-top: 16px; display: grid; gap: 8px; }
.st-report {
    padding: 10px 12px;
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    background: var(--paper);
    font-size: 0.8125rem;
}
.st-report.confirm { border-left-color: #0B6B4A; }
.st-report strong { display: block; }
.st-report span { font-size: 0.75rem; color: var(--text-muted); }
.st-empty { margin: 14px 0 0; text-align: center; font-size: 0.8125rem; color: var(--text-muted); }

.st-admin { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.st-admin h3 { font-family: var(--font-display); font-size: 1rem; margin: 0 0 12px; }
.st-admin form { padding: 14px; border: 1px dashed var(--ink); border-radius: 14px; display: grid; gap: 8px; }

/* ========================================
   Fenêtre « Signaler une rupture »
   ======================================== */
.custom-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.custom-modal.active { display: flex; }
.custom-modal-overlay { position: absolute; inset: 0; background: rgba(15, 26, 43, 0.6); }
.custom-modal-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
}
.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.custom-modal-header h3 { font-family: var(--font-display); font-size: 1.125rem; margin: 0; }
.custom-modal-close { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--text-muted); }
.custom-modal-body { padding: 22px; }
.custom-modal-body p { margin: 0 0 16px; font-size: 0.9375rem; color: var(--text-muted); }
.shortage-options { display: grid; gap: 10px; }
.shortage-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--paper);
    cursor: pointer;
}
.shortage-option:hover { border-color: var(--ink); }
.shortage-option input { width: 18px; height: 18px; accent-color: var(--ink); }
.option-name { font-weight: 600; }
.custom-modal-body .btn { width: 100%; margin-top: 20px; }
