/* === MeteoPomarico - Dark Theme Professionale === */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-card-hover: #1f2b3d;
    --border-color: #2a3a50;
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --green: #22c55e;
    --yellow: #eab308;
    --orange: #f97316;
    --red: #ef4444;
    --cyan: #06b6d4;
    --purple: #a855f7;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === TEMA LIGHT === */
[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #e2e8f0;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --border-color: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-glow: rgba(37, 99, 235, 0.1);
    --green: #16a34a;
    --yellow: #ca8a04;
    --orange: #ea580c;
    --red: #dc2626;
    --cyan: #0891b2;
    --purple: #9333ea;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .site-header {
    background: rgba(240, 244, 248, 0.85);
}

[data-theme="light"] .bg-pattern {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.06), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(8, 145, 178, 0.04), transparent);
}

[data-theme="light"] .hero-card {
    background: linear-gradient(135deg, #ffffff 0%, rgba(37, 99, 235, 0.06) 100%);
    border-color: rgba(37, 99, 235, 0.15);
}

[data-theme="light"] .hero-card::before {
    background: radial-gradient(circle, rgba(37, 99, 235, 0.03) 0%, transparent 60%);
}

[data-theme="light"] .hero-temp {
    background: linear-gradient(135deg, #0f172a, #2563eb);
    -webkit-background-clip: text;
    background-clip: text;
}

[data-theme="light"] .card:hover {
    border-color: rgba(37, 99, 235, 0.25);
}

[data-theme="light"] .forecast-day.today {
    background: rgba(37, 99, 235, 0.06);
}

[data-theme="light"] .chart-tab:hover,
[data-theme="light"] .chart-range-tab:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .chart-tab.active,
[data-theme="light"] .chart-range-tab.active {
    border-color: rgba(37, 99, 235, 0.25);
}

[data-theme="light"] .skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
}

[data-theme="light"] .forecast-day:hover {
    border-color: rgba(37, 99, 235, 0.25);
}

[data-theme="light"] .w34-compass-ring {
    border-left: 8px solid rgba(170, 170, 175, 0.5);
    border-top: 8px solid rgba(170, 170, 175, 0.85);
    border-right: 8px solid rgba(170, 170, 175, 0.5);
    border-bottom: 8px solid rgba(170, 170, 175, 0.85);
}

[data-theme="light"] .w34-tick {
    opacity: 0.4;
}

[data-theme="light"] .alert-bar-bulletin {
    border-top-color: rgba(0,0,0,0.1);
}

/* Transizioni smooth cambio tema */
body, .site-header, .card, .hero-card,
.forecast-day, .chart-card, .map-card, .bg-pattern {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* === THEME TOGGLE === */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-glow);
}

/* === LANG TOGGLE === */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.lang-toggle:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-glow);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === BACKGROUND === */
.bg-pattern {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(6, 182, 212, 0.05), transparent);
    pointer-events: none;
    z-index: 0;
}

/* === HEADER === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.site-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.site-logo .logo-icon-img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
}

.site-logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-logo h1 span {
    color: var(--accent-light);
}

/* === BARRA ALLERTE === */
.alert-bar {
    position: relative;
    z-index: 90;
    animation: alertSlideDown 0.4s ease;
}

@keyframes alertSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.alert-bar-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.alert-bar-icon svg {
    width: 16px;
    height: 16px;
}

@media (min-width: 769px) {
    .alert-bar-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    .alert-bar-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Lampeggio pulsante per allerte attive (come il live-dot) */
.alert-bar.alert-giallo .alert-bar-icon::before,
.alert-bar.alert-arancione .alert-bar-icon::before,
.alert-bar.alert-rosso .alert-bar-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    animation: alertPulse 2s ease-in-out infinite;
}

.alert-bar.alert-giallo .alert-bar-icon::before {
    background: rgba(234, 179, 8, 0.3);
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4);
    animation-name: alertPulseGiallo;
}

.alert-bar.alert-arancione .alert-bar-icon::before {
    background: rgba(249, 115, 22, 0.3);
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
    animation-name: alertPulseArancione;
}

.alert-bar.alert-rosso .alert-bar-icon::before {
    background: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    animation-name: alertPulseRosso;
}

@keyframes alertPulseGiallo {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(234, 179, 8, 0); }
}

@keyframes alertPulseArancione {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(249, 115, 22, 0); }
}

@keyframes alertPulseRosso {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.alert-bar-content {
    flex: 1;
}

.alert-bar-title {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.3;
}

.alert-bar.alert-giallo .alert-bar-title,
.alert-bar.alert-arancione .alert-bar-title,
.alert-bar.alert-rosso .alert-bar-title {
    animation: alertTextPulse 2s ease-in-out infinite;
}

@keyframes alertTextPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chevron toggle */
.alert-bar-chevron {
    flex-shrink: 0;
    opacity: 0.6;
    transition: transform 0.3s ease, opacity 0.2s;
    display: flex;
    align-items: center;
    padding: 0.25rem;
}

.alert-bar.expanded .alert-bar-chevron {
    transform: rotate(180deg);
}

.alert-bar-inner {
    cursor: pointer;
}

.alert-bar-inner:hover .alert-bar-chevron {
    opacity: 1;
}

/* Area espandibile */
.alert-bar-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.alert-bar.expanded .alert-bar-expand {
    max-height: 300px;
}

.alert-bar-expand-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 0.6rem;
}

.alert-bar-details {
    font-size: 0.78rem;
    line-height: 1.5;
}

.alert-bar-period {
    margin-bottom: 0.35rem;
}

.alert-bar-period:last-child {
    margin-bottom: 0;
}

.alert-bar-period-label {
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.8;
    margin-bottom: 0.15rem;
}

.alert-bar-risk {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.1rem 0.8rem 0.1rem 0;
    color: var(--text-primary);
}

.alert-bar-risk-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert-bar-risk.risk-giallo .alert-bar-risk-dot {
    background: #eab308;
    animation: dotPulseGiallo 2s ease-in-out infinite;
}
.alert-bar-risk.risk-arancione .alert-bar-risk-dot {
    background: #f97316;
    animation: dotPulseArancione 2s ease-in-out infinite;
}
.alert-bar-risk.risk-rosso .alert-bar-risk-dot {
    background: #ef4444;
    animation: dotPulseRosso 2s ease-in-out infinite;
}

@keyframes dotPulseGiallo {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.5); }
    50% { box-shadow: 0 0 0 4px rgba(234, 179, 8, 0); }
}
@keyframes dotPulseArancione {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5); }
    50% { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0); }
}
@keyframes dotPulseRosso {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.alert-bar-bulletin {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.alert-bar-bulletin-link {
    font-size: 0.7rem;
    opacity: 0.7;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

.alert-bar-bulletin-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.alert-bar-source {
    font-size: 0.65rem;
    opacity: 0.7;
    white-space: nowrap;
    display: none;
}

/* Verde (nessuna allerta): no chevron, no expand */
.alert-bar.alert-verde .alert-bar-chevron {
    display: none;
}

@media (min-width: 769px) {
    .alert-bar-source {
        display: block;
    }
    .alert-bar-title {
        font-size: 0.9rem;
    }
    .alert-bar-details {
        font-size: 0.82rem;
    }
    .alert-bar-risk {
        font-size: 0.8rem;
    }
}

/* Colori allerta */
.alert-bar.alert-verde {
    background: linear-gradient(90deg, rgba(34,197,94,0.15), rgba(34,197,94,0.05));
    border-bottom: 2px solid #22c55e;
}
.alert-bar.alert-verde .alert-bar-icon { background: rgba(34,197,94,0.2); color: #22c55e; }
.alert-bar.alert-verde .alert-bar-title { color: #22c55e; }
.alert-bar.alert-verde .alert-bar-close { color: #22c55e; }

.alert-bar.alert-giallo {
    background: linear-gradient(90deg, rgba(234,179,8,0.15), rgba(234,179,8,0.05));
    border-bottom: 2px solid #eab308;
}
.alert-bar.alert-giallo .alert-bar-icon { background: rgba(234,179,8,0.2); color: #eab308; }
.alert-bar.alert-giallo .alert-bar-title { color: #eab308; }
.alert-bar.alert-giallo .alert-bar-close { color: #eab308; }

.alert-bar.alert-arancione {
    background: linear-gradient(90deg, rgba(249,115,22,0.15), rgba(249,115,22,0.05));
    border-bottom: 2px solid #f97316;
}
.alert-bar.alert-arancione .alert-bar-icon { background: rgba(249,115,22,0.2); color: #f97316; }
.alert-bar.alert-arancione .alert-bar-title { color: #f97316; }
.alert-bar.alert-arancione .alert-bar-close { color: #f97316; }

.alert-bar.alert-rosso {
    background: linear-gradient(90deg, rgba(239,68,68,0.2), rgba(239,68,68,0.05));
    border-bottom: 2px solid #ef4444;
}
.alert-bar.alert-rosso .alert-bar-icon { background: rgba(239,68,68,0.25); color: #ef4444; }
.alert-bar.alert-rosso .alert-bar-title { color: #ef4444; }
.alert-bar.alert-rosso .alert-bar-close { color: #ef4444; }

.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-location {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.last-update-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.last-update-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.8;
}

#data-timestamp {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.live-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    min-height: 8px;
    flex-shrink: 0;
    display: inline-block;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* WebSocket real-time: pulsazione rapida quando connesso */
.live-dot.ws-live {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulse-fast 0.8s infinite;
}
@keyframes pulse-fast {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 4px rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.7; transform: scale(1.4); box-shadow: 0 0 12px rgba(34, 197, 94, 0.6); }
}

/* === MAIN LAYOUT === */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* === CARDS === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--shadow);
}

.card-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

.card-label i {
    font-size: 1rem;
}

.card-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.card-value .unit {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.15rem;
}

.card-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* === HERO CARD (Temperatura principale) === */
.hero-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(59, 130, 246, 0.08) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

.hero-temp {
    font-size: 5.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-temp .unit {
    font-size: 2.5rem;
    font-weight: 400;
}

.hero-label {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.share-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.25);
}

.share-btn.copied {
    color: var(--green);
    border-color: rgba(34,197,94,0.4);
    background: rgba(34,197,94,0.08);
}

[data-theme="light"] .share-btn {
    border-color: rgba(0,0,0,0.15);
    background: rgba(0,0,0,0.04);
}

[data-theme="light"] .share-btn:hover {
    background: rgba(0,0,0,0.08);
}

.unit-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0;
    text-transform: none;
}

.unit-toggle:hover {
    background: rgba(255,255,255,0.2);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.3);
}

[data-theme="light"] .unit-toggle {
    border-color: rgba(0,0,0,0.15);
    background: rgba(0,0,0,0.05);
}

[data-theme="light"] .unit-toggle:hover {
    background: rgba(0,0,0,0.1);
    border-color: rgba(0,0,0,0.2);
}

.hero-minmax {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.25rem;
    font-size: 0.95rem;
}

.hero-minmax .min { color: var(--cyan); }
.hero-minmax .max { color: var(--orange); }

/* Indicatore lineare posizione sole */
.sun-progress {
    margin-top: 0.75rem;
    padding: 0 0.25rem;
}
.sun-progress-bar {
    position: relative;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: visible;
}
.sun-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #f97316, #eab308, #f97316);
    width: 0%;
    transition: width 1s ease;
}
.sun-progress-dot {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #eab308;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
    transition: left 1s ease;
}
/* Di notte il pallino diventa grigio */
.sun-progress-dot.night {
    background: var(--text-muted);
    box-shadow: none;
}
.sun-progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 0.85rem;
}

.hero-comfort {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.hero-rain-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.hero-rain-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse-rain 1.5s ease-in-out infinite;
}
@keyframes pulse-rain {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.2); }
}

.trend-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
}

.trend-up { color: var(--orange); }
.trend-down { color: var(--cyan); }
.trend-stable { color: var(--text-muted); }

/* === GRID LAYOUT === */
.weather-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.weather-grid-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
}

.weather-grid-bottom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

/* === RECORD STORICI === */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.record-card .card-value {
    font-size: 2rem;
}

.records-meta {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* === OGGI L'ANNO SCORSO === */
.last-year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
}

.last-year-date {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* === ESTREMI MENSILI === */
.monthly-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.monthly-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.85rem;
}

.monthly-table th,
.monthly-table td {
    padding: 0.6rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.monthly-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.monthly-table td {
    color: var(--text-primary);
}

.monthly-table th:first-child,
.monthly-table td:first-child {
    width: 1%;
    white-space: nowrap;
    text-align: left;
    font-weight: 500;
}

.monthly-table td.temp-max {
    color: var(--orange);
    font-weight: 600;
}

.monthly-table td.temp-min {
    color: var(--cyan);
    font-weight: 600;
}

.monthly-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.monthly-table tbody tr:last-child td {
    border-bottom: none;
}

/* === SEZIONE INDOOR === */
.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 2.5rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* === PREVISIONI 7 GIORNI === */
.forecast-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
}

.forecast-day {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 0.75rem;
    text-align: center;
    transition: var(--transition);
}

.forecast-day:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59, 130, 246, 0.3);
}

.forecast-day.today {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.forecast-day-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.forecast-icon {
    font-size: 2rem;
    margin: 0.5rem 0;
}

.forecast-temps {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.forecast-temps .max { color: var(--text-primary); }
.forecast-temps .min { color: var(--text-muted); }

.forecast-precip {
    font-size: 0.75rem;
    color: var(--cyan);
    margin-top: 0.35rem;
}

.forecast-wind {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* === PREVISIONI ORARIE === */
.hourly-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.hourly-scroll::-webkit-scrollbar {
    height: 6px;
}

.hourly-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.hourly-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.hourly-item {
    flex: 0 0 auto;
    min-width: 75px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.5rem;
    text-align: center;
    scroll-snap-align: start;
    transition: var(--transition);
}

.hourly-item.new-day {
    border-top: 2px solid var(--accent);
}

.hourly-day {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.hourly-item:hover {
    background: var(--bg-card-hover);
}

.hourly-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.hourly-icon {
    font-size: 1.3rem;
    margin: 0.35rem 0;
}

.hourly-temp {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}


/* === MAPPE & IFRAME === */
.map-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    overflow: hidden;
}

.embed-iframe {
    display: block;
    width: 100%;
    height: 400px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

/* === OVERLAY IFRAME (blocca scroll accidentale su mobile) === */
.iframe-wrapper {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.iframe-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.iframe-overlay.active {
    display: none;
}

.iframe-overlay-msg {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(6px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.iframe-overlay:hover .iframe-overlay-msg,
.iframe-overlay:focus .iframe-overlay-msg {
    opacity: 1;
}

/* Su desktop l'overlay non serve */
@media (hover: hover) and (pointer: fine) {
    .iframe-overlay { display: none; }
}

/* === GESTURE HINT LEAFLET === */
.leaflet-gesture-overlay {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.leaflet-gesture-overlay.visible {
    opacity: 1;
}

.leaflet-gesture-msg {
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
    text-align: center;
}

.map-credit {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

.map-credit a {
    color: var(--accent-light);
    text-decoration: none;
}


/* === GRIGLIA MAPPE 2 COLONNE === */
.maps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.maps-grid .section-title {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.maps-grid .embed-iframe {
    height: 350px;
}

/* === WEBCAM BANNER === */
.webcam-banner {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webcam-banner-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0c1929 0%, #162a4a 40%, #1a3a5c 70%, #0f2440 100%);
    z-index: 0;
}

.webcam-banner-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 70% 50%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
}

.webcam-banner-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.webcam-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
}

.webcam-live-badge .live-dot {
    width: 6px;
    height: 6px;
    background: #ef4444;
}

.webcam-banner-icon {
    color: var(--accent-light);
    opacity: 0.6;
    margin: 0.25rem 0;
}

.webcam-banner-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f0f4f8;
}

.webcam-banner-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
}

.webcam-btn {
    margin-top: 0.5rem;
    padding: 0.6rem 1.5rem;
}

.webcam-credit {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.webcam-credit a {
    color: #94a3b8;
    text-decoration: none;
}

.webcam-credit a:hover {
    color: var(--accent-light);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

/* === QUALITA' ARIA - SEZIONE === */
.air-quality-section {
    display: grid !important;
    grid-template-columns: 300px 1fr;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

.aqi-main {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 200px;
}

.aqi-score-container {
    margin-bottom: 1.5rem;
}

.aqi-score {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.aqi-label {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.35rem;
}

.aqi-scale-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.aqi-scale {
    width: 100%;
}

.aqi-scale-bar {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #22c55e 0%, #84cc16 20%, #eab308 40%, #f97316 60%, #ef4444 80%, #7c3aed 100%);
    position: relative;
    margin-bottom: 0.5rem;
}

.aqi-scale-indicator {
    position: absolute;
    top: -4px;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border: 3px solid var(--bg-card);
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.5s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.aqi-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Inquinanti */
.pollutants-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.75rem;
}

.pollutant-card {
    padding: 1rem !important;
    text-align: center;
    cursor: help;
}

.pollutant-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pollutant-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.pollutant-unit {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.pollutant-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.pollutant-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease, background-color 0.5s ease;
    background: var(--green);
}

/* Pollini */
.pollen-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem;
}

.pollen-card {
    padding: 1.25rem 1rem !important;
    text-align: center;
}

.pollen-icon {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

.pollen-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.pollen-gauge {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.pollen-gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.pollen-value {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.pollen-level {
    font-size: 0.7rem;
    font-weight: 500;
}

.pollen-source {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

.pollen-none { color: var(--text-muted); }
.pollen-low { color: var(--green); }
.pollen-moderate { color: var(--yellow); }
.pollen-high { color: var(--orange); }
.pollen-very-high { color: var(--red); }

/* AQI COLORS */
.aqi-good { color: var(--green); }
.aqi-fair { color: var(--yellow); }
.aqi-moderate { color: var(--orange); }
.aqi-poor { color: var(--red); }
.aqi-very-poor { color: #7c3aed; }

/* UV COLORS */
.uv-low { color: var(--green); }
.uv-moderate { color: var(--yellow); }
.uv-high { color: var(--orange); }
.uv-very-high { color: var(--red); }
.uv-extreme { color: #a855f7; }

/* === GRAFICO === */
.chart-container {
    margin-top: 2.5rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
}

.chart-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}

.chart-range-tabs {
    display: flex;
    gap: 0.3rem;
}

.chart-tabs {
    display: flex;
    gap: 0.5rem;
}

.chart-tab,
.chart-range-tab {
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.chart-range-tab {
    font-size: 0.72rem;
    padding: 0.25rem 0.65rem;
    border: 1px solid var(--border-color);
}

.chart-tab:hover,
.chart-range-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.chart-tab.active {
    color: var(--accent-light);
    background: var(--accent-glow);
    border-color: rgba(59, 130, 246, 0.3);
}

.chart-range-tab.active {
    color: var(--accent-light);
    background: var(--accent-glow);
    border-color: rgba(59, 130, 246, 0.3);
}

.chart-wrapper {
    position: relative;
    height: 280px;
}

/* === FOOTER === */
.site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    padding: 0;
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    gap: 5rem;
}

.footer-grid > :last-child {
    text-align: right;
}

.footer-col-brand {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem;
}

.footer-logo-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.footer-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.footer-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
}

.footer-logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.footer-logo-text span {
    color: var(--accent-light);
}

.footer-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.footer-col-links {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.4rem;
}

.footer-col-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.footer-col-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition);
}

.footer-col-links a:hover {
    color: var(--accent-light);
}

.footer-disclaimer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
    opacity: 0.7;
}
.footer-disclaimer a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.2);
}
.footer-disclaimer a:hover {
    color: var(--accent-color);
}

.footer-bottom-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-bottom-bar strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* === NO DATA STATE === */
.no-data {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-data i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* === STATS PAGE === */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card .stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent-light);
}

.stats-chart-container {
    margin-bottom: 2rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.stats-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-table td {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === LOGIN FORM === */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input[type="password"] {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.login-form input[type="password"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-glow);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-info {
        gap: 1rem;
    }

    .weather-grid-top {
        grid-template-columns: 1fr;
    }

    .weather-grid-bottom {
        grid-template-columns: 1fr;
    }

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

    .iframe-map {
        padding-bottom: 60%;
    }

    .maps-grid {
        grid-template-columns: 1fr;
    }

    .embed-iframe {
        height: 300px;
    }

    .w34-compass {
        width: 175px;
        height: 175px;
    }

    .w34-compass-ring { inset: 20px; }
    .w34-tick { transform-origin: 50% calc((175px - 40px) / 2); }

    .wind-gauge-stats {
        gap: 0.75rem;
    }

    .marine-leaflet-map {
        height: 350px;
    }

    .marine-forecast-item {
        flex: 0 0 110px;
    }

    .hero-temp {
        font-size: 4rem;
    }

    .hero-card {
        padding: 2rem 1.5rem;
    }

    .air-quality-section {
        grid-template-columns: 1fr;
    }

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

    .pollen-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

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

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        text-align: center;
    }

    .footer-logo-row {
        justify-content: center;
    }

    .footer-col-brand {
        align-items: center !important;
    }

    .footer-col-links {
        align-items: center !important;
    }

    .footer-bottom-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem 1rem 3rem;
    }

    .hero-temp {
        font-size: 3.5rem;
    }

    .card-value {
        font-size: 2rem;
    }

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

    .maps-grid .embed-iframe {
        height: 250px;
    }

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

    .pollen-grid {
        grid-template-columns: 1fr !important;
    }

    .aqi-score {
        font-size: 2.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .w34-compass {
        width: 160px;
        height: 160px;
    }

    .w34-compass-ring { inset: 18px; }
    .w34-tick { transform-origin: 50% calc((160px - 36px) / 2); }

    .w34-degrees {
        font-size: 1.4rem;
    }

    .w34-windname {
        font-size: 0.7rem;
    }

    .w34-label { font-size: 11px; }
    .w34-label-n { font-size: 13px; }
    .w34-label-inter { font-size: 8px; }

    .wind-gauge-stats {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .wind-stat-value {
        font-size: 1.2rem;
    }

    .wind-bft-label {
        font-size: 0.5rem;
    }

    .coast-card-state {
        font-size: 1.1rem;
    }

    .coast-card-row {
        font-size: 0.75rem;
    }

    .coast-loc-row {
        font-size: 0.7rem;
    }

    .marine-leaflet-map {
        height: 300px;
    }

    .marine-forecast-item {
        flex: 0 0 100px;
        padding: 0.5rem 0.4rem;
    }
}

/* === LOADING / SKELETON === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    width: 60%;
}

.skeleton-value {
    height: 2.5rem;
    width: 40%;
    margin-top: 0.5rem;
}

/* === PRESSURE INDICATOR === */
.pressure-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 0.75rem;
    position: relative;
    overflow: hidden;
}

.pressure-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--cyan), var(--green), var(--yellow), var(--orange));
    transition: width var(--transition);
}

/* === VENTI E MARI === */

/* Mappa Leaflet mari */
.marine-map-leaflet-wrap {
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.marine-leaflet-map {
    width: 100%;
    height: 420px;
    background: var(--bg-card);
}

/* Marker circolare personalizzato */
.marine-marker {
    border: none !important;
    background: none !important;
}

.marine-marker-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    position: relative;
}

.marine-marker-dot::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid;
    border-color: inherit;
    opacity: 0.3;
    animation: markerPulse 2.5s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50%      { transform: scale(1.5); opacity: 0; }
}

/* Popup Leaflet personalizzato */
.marine-popup .leaflet-popup-content-wrapper {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 0;
}

.marine-popup .leaflet-popup-content {
    margin: 0;
    min-width: 160px;
}

.marine-popup .leaflet-popup-tip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.marine-popup-inner {
    padding: 0.75rem 1rem;
}

.marine-popup-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.marine-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding: 0.2rem 0;
    color: var(--text-secondary);
}

.marine-popup-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* Tooltip permanente sulla mappa */
.marine-tooltip {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    font-size: 0.72rem !important;
    line-height: 1.4 !important;
    box-shadow: var(--shadow) !important;
    white-space: nowrap !important;
}

.marine-tooltip::before {
    border-right-color: var(--border-color) !important;
}

.leaflet-tooltip-left.marine-tooltip::before {
    border-left-color: var(--border-color) !important;
    border-right-color: transparent !important;
}

/* Marker con label integrato sulla mappa marine */
.marine-marker-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.marine-marker-label .mml-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.marine-marker-label .mml-text {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.marine-marker-label .mml-text strong { font-size: 12px; }
.marine-marker-label .mml-info { font-size: 10px; color: var(--text-secondary); }
.marine-marker-label .mml-temp { color: #06b6d4; font-weight: 600; }
.marine-marker-label .mml-score { color: #7B9CFF; font-weight: 700; }

/* Popup MapLibre */
.maplibregl-popup-content {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
    border: 1px solid var(--border-color) !important;
    padding: 10px 14px !important;
}
.maplibregl-popup-tip {
    border-top-color: var(--bg-card) !important;
}

/* Consiglio automatico */
.marine-advice-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--accent);
}

.marine-advice-card.advice-adriatic { border-left-color: var(--cyan); }
.marine-advice-card.advice-ionico   { border-left-color: var(--green); }
.marine-advice-card.advice-none     { border-left-color: var(--red); }

.marine-advice-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.marine-advice-main {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.marine-advice-reason {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}


/* Layout: Vento (singolo) + Coste (grid separato) */
.marine-top-grid {
    margin-bottom: 1.25rem;
}

.marine-coast-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* === WIND GAUGE === */
/* === Bussola vento (stile Weather34 migliorata) === */
.w34-compass {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 0.5rem auto 0;
}

.w34-compass-ring {
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    border-left: 8px solid rgba(95, 96, 97, 0.5);
    border-top: 8px solid rgba(95, 96, 97, 0.8);
    border-right: 8px solid rgba(95, 96, 97, 0.5);
    border-bottom: 8px solid rgba(95, 96, 97, 0.8);
}

/* --- Labels cardinali fuori dall'anello --- */
.w34-label {
    position: absolute;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    z-index: 5;
    line-height: 1;
}

.w34-label-n  { top: 2px;   left: 50%; transform: translateX(-50%); color: #ef4444; font-size: 15px; }
.w34-label-s  { bottom: 2px;left: 50%; transform: translateX(-50%); }
.w34-label-e  { right: 2px; top: 50%;  transform: translateY(-50%); }
.w34-label-w  { left: 2px;  top: 50%;  transform: translateY(-50%); }

.w34-label-inter {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.7;
}

.w34-label-ne { top: 12px;   right: 10px; }
.w34-label-se { bottom: 12px;right: 10px; }
.w34-label-sw { bottom: 12px;left: 10px;  }
.w34-label-nw { top: 12px;   left: 10px;  }

/* --- Tacche sull'anello (8 posizioni) --- */
.w34-tick {
    position: absolute;
    width: 2px;
    height: 10px;
    background: var(--text-muted);
    opacity: 0.5;
    left: 50%;
    top: 0;
    margin-left: -1px;
    transform-origin: 50% calc((190px - 44px) / 2);
}

.w34-tick-0   { transform: rotate(0deg);   background: #ef4444; opacity: 0.8; height: 12px; width: 2.5px; margin-left: -1.25px; }
.w34-tick-45  { transform: rotate(45deg);  }
.w34-tick-90  { transform: rotate(90deg);  }
.w34-tick-135 { transform: rotate(135deg); }
.w34-tick-180 { transform: rotate(180deg); }
.w34-tick-225 { transform: rotate(225deg); }
.w34-tick-270 { transform: rotate(270deg); }
.w34-tick-315 { transform: rotate(315deg); }

/* --- Freccia attuale (arancione) --- */
.w34-arrow {
    position: absolute;
    z-index: 200;
    top: 0;
    left: 50%;
    margin-left: -5px;
    width: 10px;
    height: 50%;
    transform-origin: 50% 100%;
    transition: transform 3s ease;
}

/* Punta triangolare */
.w34-arrow::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 17px 11px 0 11px;
    border-color: rgba(255, 121, 58, 1) transparent transparent transparent;
    transform: translate(-50%, -50%);
}

/* Cerchietto alla base della punta */
.w34-arrow::before {
    content: '';
    position: absolute;
    z-index: 9;
    left: 2px;
    top: -5px;
    width: 6px;
    height: 6px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    background: rgba(255, 124, 57, 0.3);
}

/* Pallini sotto il triangolo (prolungano la freccia) */
.w34-arrow-dot {
    position: absolute;
    left: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 121, 58, 0.85);
    transform: translateX(-50%);
}

.w34-arrow-dot-1 { top: 10px; }
.w34-arrow-dot-2 { top: 19px; }

/* --- Testo centrale --- */
.w34-compass-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
    padding-top: 20px;
}

.w34-degrees {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    font-family: system-ui, -apple-system, sans-serif;
}

.w34-windname {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 121, 58, 1);
    margin-top: 0.15rem;
}

/* Stats sotto il gauge */
.wind-gauge-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.wind-stat {
    text-align: center;
    min-width: 0;
    flex: 1;
}

.wind-stat-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wind-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-light);
    line-height: 1.15;
}

.wind-stat-gusts {
    color: var(--orange);
}

.wind-stat-bft {
    font-size: 1.5rem;
}

.wind-bft-label {
    font-size: 0.55rem;
}

.wind-stat-unit {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.wind-stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* Beaufort colori */
.bft-0  { color: #a8d8ea !important; }
.bft-1  { color: #88c4e0 !important; }
.bft-2  { color: #6bb5d6 !important; }
.bft-3  { color: #90b12a !important; }
.bft-4  { color: #b8cc33 !important; }
.bft-5  { color: #f0c929 !important; }
.bft-6  { color: #f5a623 !important; }
.bft-7  { color: #f07c39 !important; }
.bft-8  { color: #ef4444 !important; }
.bft-9  { color: #dc2626 !important; }
.bft-10 { color: #b91c1c !important; }
.bft-11 { color: #991b1b !important; }
.bft-12 { color: #7f1d1d !important; }

/* Card riepilogo costa */
.marine-coast-card {
    position: relative;
    overflow: hidden;
}

.coast-card-stripe {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.coast-card-adriatico .coast-card-stripe { background: linear-gradient(90deg, var(--cyan), var(--accent)); }
.coast-card-ionico .coast-card-stripe    { background: linear-gradient(90deg, var(--green), var(--cyan)); }

.coast-card-state {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0.35rem 0 0.65rem;
    line-height: 1.1;
}

.coast-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.coast-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.coast-card-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.coast-card-locations {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.coast-loc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.73rem;
}

.coast-loc-name {
    color: var(--text-secondary);
}

.coast-loc-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.coast-loc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.coast-loc-value {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.coast-loc-score {
    color: #7B9CFF;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 4px;
}
.coast-loc-score::before {
    content: '\2022';
    margin-right: 3px;
    opacity: 0.4;
}

/* Card Migliori Spiagge */
.best-beach-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
}
.best-beach-item:last-child { border-bottom: none; }
.best-beach-rank { font-size: 1.4rem; min-width: 28px; text-align: center; }
.best-beach-info { flex: 1; min-width: 0; }
.best-beach-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.best-beach-detail { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.best-beach-score { text-align: center; min-width: 50px; }
.best-beach-score-num { display: block; font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.best-beach-score-label { display: block; font-size: 0.65rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.best-beaches-avg { margin-top: 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--border-color); text-align: center; }

@media (max-width: 768px) {
    .marine-coast-grid { grid-template-columns: 1fr !important; }
}

/* Legenda mappa */
.marine-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.marine-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.marine-legend-item i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Tabella mari (rimossa, legacy) */
.marine-table-wrapper {
    display: none;
}

.marine-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.85rem;
}

.marine-table th,
.marine-table td {
    padding: 0.6rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.marine-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.marine-table td {
    color: var(--text-primary);
}

.marine-table td:first-child {
    text-align: left;
    font-weight: 500;
    width: 1%;
    white-space: nowrap;
}

.marine-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.marine-table tbody tr:last-child td {
    border-bottom: none;
}

/* Separatore costa con label */
.marine-coast-header td {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    text-align: left !important;
}

.marine-coast-header.coast-adriatico td { border-left: 3px solid var(--cyan); }
.marine-coast-header.coast-punta td     { border-left: 3px solid var(--purple); }
.marine-coast-header.coast-ionico td    { border-left: 3px solid var(--green); }

/* Badge stato mare */
.sea-state-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.sea-calm        { background: rgba(34, 197, 94, 0.15);  color: var(--green); }
.sea-slight      { background: rgba(234, 179, 8, 0.15);  color: var(--yellow); }
.sea-moderate    { background: rgba(249, 115, 22, 0.15); color: var(--orange); }
.sea-rough       { background: rgba(239, 68, 68, 0.15);  color: var(--red); }
.sea-very-rough  { background: rgba(168, 85, 247, 0.15); color: var(--purple); }

/* Temperatura mare nella tabella */
.sea-temp-value {
    color: var(--cyan);
    font-weight: 600;
}

/* Previsione 3 giorni scroll */
.marine-forecast-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
}

.marine-forecast-item {
    flex: 0 0 110px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.5rem;
    text-align: center;
    scroll-snap-align: start;
    transition: var(--transition);
}

.marine-forecast-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59, 130, 246, 0.3);
}

.marine-forecast-item.new-day {
    border-top: 2px solid var(--accent);
}

.marine-forecast-day {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.marine-forecast-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

.marine-forecast-wind-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.1rem;
}

.marine-forecast-wind-speed {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.marine-forecast-arrow {
    display: inline-block;
    font-size: 1.1rem;
    margin: 0.2rem 0;
    color: var(--accent-light);
    line-height: 1;
}

.marine-forecast-seas {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border-color);
}

.fc-sea {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.fc-adri {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
}

.fc-ioni {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

/* === WIND PLACEHOLDER === */
.coming-soon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    padding: 1rem;
}

/* === LIGHTNING CARD === */
.lightning-bolt {
    color: var(--yellow);
}

/* === SOLAR RADIATION CARD === */
.solar-radiation-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 0.75rem;
    position: relative;
    overflow: hidden;
}

.solar-radiation-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--yellow), var(--orange), var(--red));
    transition: width var(--transition);
}
