/* ==========================================================================
   MÉTÉO CHAVAILLE - STYLE PRINCIPAL
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #0f172a;
    color: #f8fafc;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* --- EN-TÊTE PROFESSIONNEL --- */
.header-pro { display: flex; justify-content: space-between; align-items: center; padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.header-brand { display: flex; align-items: center; gap: 1.25rem; }
.header-logo { background: rgba(14, 165, 233, 0.1); padding: 12px; border-radius: 14px; display: flex; border: 1px solid rgba(14, 165, 233, 0.2); box-shadow: 0 4px 15px rgba(14, 165, 233, 0.15); }
.header-titles h1 { font-size: 2rem; font-weight: 800; margin: 0; letter-spacing: 0.5px; color: #f8fafc; line-height: 1.1; }
.header-titles h1 span { background: linear-gradient(135deg, #38bdf8, #3b82f6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.header-subtitle { font-size: 0.95rem; color: #94a3b8; font-weight: 500; margin-top: 4px; display: flex; align-items: center; gap: 8px; }

.status-indicator { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: #94a3b8; background: rgba(0, 0, 0, 0.2); padding: 8px 16px; border-radius: 30px; border: 1px solid rgba(255, 255, 255, 0.05); }
.pulse { display: inline-block; width: 8px; height: 8px; background-color: #10b981; border-radius: 50%; box-shadow: 0 0 8px #10b981; animation: pulse-anim 2s infinite; }
@keyframes pulse-anim { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* --- BANNIÈRE D'ALERTE --- */
.alert-banner { padding: 1rem 1.5rem; border-radius: 12px; display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.alert-green { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); }
.alert-yellow { background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3); }
.alert-orange { background: rgba(249, 115, 22, 0.1); border: 1px solid rgba(249, 115, 22, 0.3); }
#alert-desc { color: #cbd5e1; font-size: 0.9rem; margin-top: 3px; }

/* --- NAVIGATION --- */
.tabs-nav { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; background: #1e293b; padding: 0.5rem; border-radius: 12px; }
.tab-btn { flex: 1; background: transparent; border: none; color: #94a3b8; padding: 0.75rem 1rem; font-size: 1rem; font-weight: 600; cursor: pointer; border-radius: 8px; transition: all 0.3s ease; }
.tab-btn:hover { color: #f8fafc; background: rgba(255, 255, 255, 0.05); }
.tab-btn.active { background: #0ea5e9; color: #ffffff; box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3); }
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- COMPOSANTS GÉNÉRIQUES --- */
.card { background: #1e293b; border-radius: 16px; padding: 1.5rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.05); }
.btn-primary { color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: transform 0.2s, filter 0.2s; background: #38bdf8; }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }

/* --- GRILLE DU DIRECT --- */
.metrics-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.metric-item { background: #1e293b; padding: 1.25rem; border-radius: 12px; text-align: center; border: 1px solid rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; justify-content: center; }
.metric-item span { display: block; font-size: 0.85rem; color: #94a3b8; text-transform: uppercase; margin-bottom: 0.5rem; }
.metric-item strong { font-size: 1.75rem; font-weight: 700; }
.text-orange { color: #f97316; } .text-blue { color: #38bdf8; } .text-green { color: #10b981; } .text-red { color: #ef4444; } .text-purple { color: #a855f7; } .text-yellow { color: #eab308; }

/* --- BOUSSOLE ANIMÉE --- */
.compass-box { width: 44px; height: 44px; border: 2px solid rgba(255, 255, 255, 0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; margin: 0.5rem auto; background: rgba(0, 0, 0, 0.2); }
.compass-box::after { content: 'N'; position: absolute; top: -8px; font-size: 0.65rem; color: #ef4444; font-weight: 800; background: #1e293b; padding: 0 4px; border-radius: 3px; }
.compass-arrow { color: #38bdf8; display: flex; transform-origin: center; transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* --- ÉPHÉMÉRIDE & DICTON --- */
.ephem-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 1.5rem; align-items: center; }
.ephem-sun p, .ephem-moon p { margin: 0; line-height: 1.4; }
.ephem-quote { background: rgba(16, 185, 129, 0.05); padding: 1.25rem; border-radius: 12px; border: 1px solid rgba(16, 185, 129, 0.2); }
.ephem-quote blockquote { font-style: italic; color: #38bdf8; font-size: 1.1rem; border-left: 3px solid #38bdf8; padding-left: 1rem; margin: 0; line-height: 1.5; }
.badge-fete { font-size: 0.9rem; color: #d8b4fe; background: rgba(168, 85, 247, 0.1); padding: 4px 12px; border-radius: 20px; border: 1px solid rgba(168, 85, 247, 0.2); }
.badge-fete strong { color: #a855f7; font-weight: 700; }

/* --- GRAPHIQUES --- */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.chart-container h3 { font-size: 1rem; color: #cbd5e1; margin-bottom: 1rem; font-weight: 500; }

/* --- PRÉVISIONS --- */
.forecast-grid-pro { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.forecast-card-pro { background: rgba(0,0,0,0.2); border-radius: 12px; padding: 1rem; text-align: center; border: 1px solid rgba(255,255,255,0.05); }
.forecast-date-pro { font-weight: 600; margin-bottom: 0.5rem; color: #38bdf8; }
.forecast-icon-pro { font-size: 2.5rem; margin: 0.5rem 0; }
.forecast-label-pro { font-size: 0.9rem; color: #cbd5e1; margin-bottom: 0.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: center; }
.forecast-temp-pro { display: flex; justify-content: center; gap: 1rem; font-weight: 700; margin-bottom: 1rem; }
.forecast-temp-pro .min { color: #38bdf8; } .forecast-temp-pro .max { color: #f97316; }
.forecast-metrics-pro { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 0.5rem; font-size: 0.85rem; color: #94a3b8; }

/* --- RADAR WINDY --- */
.radar-container { padding: 0; overflow: hidden; }
.radar-controls { padding: 1rem; display: flex; gap: 0.5rem; background: rgba(0,0,0,0.2); border-bottom: 1px solid rgba(255,255,255,0.05); }
.radar-btn { background: transparent; color: #94a3b8; border: 1px solid #334155; padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; }
.radar-btn.active { background: #0ea5e9; color: white; border-color: #0ea5e9; }
iframe#windy-iframe { width: 100%; height: 500px; display: block; }


/* ==========================================================================
   RESPONSIVE DESIGN (Mobiles et Tablettes) - FORCÉ POUR SMARTPHONES
   ========================================================================== */
@media (max-width: 1024px) {
    .metrics-row { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-container { padding: 0.75rem; }
    
    .header-pro { flex-direction: column; align-items: center; text-align: center; gap: 0.75rem; padding-bottom: 1rem; margin-bottom: 1rem; }
    .header-brand { flex-direction: column; }
    
    /* LE SECRET POUR LES ONGLETS : SCROLL HORIZONTAL FAÇON APP MOBILE */
    .tabs-nav { 
        display: flex; 
        flex-wrap: nowrap; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; /* Glissement fluide sur iPhone */
        padding: 0.25rem;
        justify-content: flex-start;
        scrollbar-width: none; /* Cache la barre sur Firefox */
    }
    .tabs-nav::-webkit-scrollbar { display: none; /* Cache la barre sur Chrome/Safari */ }
    
    .tab-btn { 
        flex: 0 0 auto; /* Empêche les boutons de s'écraser */
        white-space: nowrap; /* Force le texte sur 1 seule ligne */
        font-size: 0.95rem; 
        padding: 0.6rem 1.2rem; 
        margin-right: 0.5rem;
    }
    
    /* Blocs de données ultra-compacts */
    .metrics-row { gap: 0.5rem; }
    .metric-item { padding: 0.75rem 0.25rem; }
    .metric-item span { font-size: 0.70rem; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .metric-item strong { font-size: 1.3rem; }
    
    .compass-box { width: 36px; height: 36px; }

    /* Éphéméride */
    .ephem-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .ephem-quote { grid-column: 1 / -1; margin-top: 0.5rem; }
    .ephem-quote div { flex-direction: column; align-items: flex-start !important; gap: 0.5rem; }
    
    .forecast-grid-pro { grid-template-columns: 1fr; }
    .radar-controls { flex-direction: column; }
    .radar-btn { width: 100%; }
}