/* === LecceMeteo - 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 {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .chart-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);
}

/* 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);
}

.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 h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.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;
}

.live-dot {
    width: 8px;
    height: 8px;
    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); }
}

/* === 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);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.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); }

.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: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

/* === 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.75rem 0.5rem;
    text-align: center;
    transition: var(--transition);
}

.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);
}

.hourly-precip {
    font-size: 0.7rem;
    color: var(--cyan);
    margin-top: 0.2rem;
}

/* === 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);
}

.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;
}

.radar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

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

.radar-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === 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: #dc2626; }

/* === 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: center;
    margin-bottom: 1rem;
}

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

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

.chart-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-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-wrapper {
    position: relative;
    height: 280px;
}

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

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

.footer-info {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

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

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

/* === 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;
    }

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

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

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

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

    .footer-inner {
        flex-direction: column;
        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;
    }

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

/* === 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);
}

/* === 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;
}
