/**
 * Clima Londrina Modern Stylesheet
 * 
 * Este arquivo define a identidade visual do portal baseada em Glassmorphism,
 * com suporte completo a temas Claro/Escuro (sem cores roxas clichês),
 * transições e animações fluidas, e design Mobile-First.
 * 
 * Codificação: UTF-8 (Padrão de acentuação em Português do Brasil)
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- VARIÁVEIS DE TEMA (TOKENS DO DESIGN.md) --- */
:root {
    /* Cores Semânticas Gerais */
    --primary: #0284c7;
    --primary-dark: #0369a1;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    
    /* Configurações do Tema Claro */
    --light-bg: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    --light-surface: rgba(255, 255, 255, 0.70);
    --light-border: rgba(255, 255, 255, 0.45);
    --light-text: #0f172a;
    --light-muted: #475569;
    --light-shadow: 0 10px 30px -5px rgba(2, 132, 199, 0.08);

    /* Configurações do Tema Escuro */
    --dark-bg: linear-gradient(135deg, #070d14 0%, #0e1a24 100%);
    --dark-surface: rgba(13, 22, 33, 0.65);
    --dark-border: rgba(255, 255, 255, 0.08);
    --dark-text: #f8fafc;
    --dark-muted: #94a3b8;
    --dark-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.4);

    /* Arredondamentos */
    --rounded-sm: 6px;
    --rounded-md: 16px;
    --rounded-lg: 24px;
    --rounded-full: 9999px;

    /* Espaçamentos */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

/* --- TEMA DINÂMICO VIA CLASSE --- */
body.light {
    --bg-gradient: var(--light-bg);
    --surface: var(--light-surface);
    --border: var(--light-border);
    --text-main: var(--light-text);
    --text-muted: var(--light-muted);
    --shadow: var(--light-shadow);
}

body.dark {
    --bg-gradient: var(--dark-bg);
    --surface: var(--dark-surface);
    --border: var(--dark-border);
    --text-main: var(--dark-text);
    --text-muted: var(--dark-muted);
    --shadow: var(--dark-shadow);
}

/* --- RESET & LAYOUT GLOBAL --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    padding: var(--space-lg) var(--space-md);
    transition: background 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* --- BARRA DE PROGRESSO DE CARREGAMENTO --- */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--success) 50%, var(--warning) 100%);
    width: 0%;
    z-index: 1000;
    transition: width 0.2s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.5s ease;
    opacity: 0;
}

.loading-bar.active {
    opacity: 1;
}

/* --- CABEÇALHO --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid var(--border);
    padding-bottom: var(--space-md);
    animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.city-title-box h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.city-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* Botões Modernos */
.btn-icon {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: var(--rounded-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    background: rgba(255,255,255,0.1);
}

.btn-sync {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0 16px;
    height: 44px;
    border-radius: var(--rounded-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(12px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sync:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.btn-sync i.spinning {
    animation: spin 1s linear infinite;
}

/* Status Metadata */
.meta-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 600;
    animation: fadeIn 0.8s ease forwards;
}

.status-badge {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--rounded-full);
    color: var(--text-muted);
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.status-badge.reconciled {
    border-color: var(--success);
    color: var(--success);
    background: rgba(5, 150, 105, 0.08);
}

.update-time {
    color: var(--text-muted);
}

/* --- GLASSMORPHIC CARDS --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--rounded-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.2);
}

/* --- HERO SECTION --- */
.hero-section {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: var(--space-lg);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.hero-left {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    border-radius: var(--rounded-lg);
    padding: var(--space-lg) var(--space-xl);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 240px;
    position: relative;
    overflow: hidden;
}

.hero-salutation {
    font-size: 1.05rem;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.hero-temp-box {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.hero-temp {
    font-family: 'Outfit', sans-serif;
    font-size: 5.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-main);
    letter-spacing: -0.04em;
}

.hero-unit {
    font-family: 'Outfit', sans-serif;
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--primary);
}

.hero-condition {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: var(--space-xs);
}

.hero-stats {
    margin-top: var(--space-md);
    font-size: 1.05rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
}

.hero-stats strong {
    color: var(--text-main);
}

/* Painel Astronomia */
.astro-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    border-radius: var(--rounded-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.astro-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.astro-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 600;
}

.astro-item i {
    margin-right: 6px;
}

.sun-cycle {
    position: relative;
    height: 8px;
    background: rgba(120, 120, 120, 0.15);
    border-radius: var(--rounded-full);
    margin: var(--space-lg) 0;
    overflow: visible;
}

.sun-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: var(--rounded-full);
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, #f59e0b 100%);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon-pos {
    position: absolute;
    right: -8px;
    top: -4px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border: 3px solid #fbbf24;
    border-radius: 50%;
    box-shadow: 0 0 10px #fbbf24;
}

.astro-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* --- SECTIONS COMUNS --- */
.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

/* --- DASHBOARD: GRÁFICOS DE TENDÊNCIA --- */
.chart-section {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    border-radius: var(--rounded-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.chart-header .section-title {
    margin-bottom: 0;
}

.chart-legend {
    display: flex;
    gap: var(--space-md);
    font-size: 0.85rem;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

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

.legend-dot.max {
    background: var(--primary);
}

.legend-dot.min {
    background: var(--success);
}

.chart-container {
    height: 200px;
    position: relative;
    width: 100%;
}

.weather-svg-chart {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.chart-tooltip {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--rounded-md);
    font-size: 0.8rem;
    font-weight: 700;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
}

/* --- GRID CARDS FONTES --- */
.sources-section {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.grid-sources {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.source-tag {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.05em;
}

.real-badge {
    background: rgba(5, 150, 105, 0.12);
    color: var(--success);
    padding: 2px 8px;
    border-radius: var(--rounded-sm);
    font-size: 0.68rem;
    font-weight: 800;
    margin-left: 8px;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.card-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--space-md);
}

.card-temp {
    font-family: 'Outfit', sans-serif;
    font-size: 3.1rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
    font-weight: 600;
}

.card-icon {
    font-size: 2.85rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.12));
}

.detail-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding-top: var(--space-md);
}

.d-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: var(--space-xs);
}

.d-row:last-child {
    margin-bottom: 0;
}

.d-label {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.d-label i {
    color: var(--primary);
    width: 14px;
}

.d-val {
    font-weight: 700;
    color: var(--text-main);
}

/* --- RADAR METEOROLÓGICO --- */
.radar-section {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

.radar-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    border-radius: var(--rounded-lg);
    height: 380px;
    width: 100%;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
}

.radar-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 600;
    z-index: 2;
    transition: opacity 0.5s ease;
}

.radar-skeleton i {
    font-size: 2rem;
    color: var(--primary);
}

.radar-iframe-container {
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.radar-iframe-container.loaded {
    opacity: 1;
}

.radar-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- PREVISÃO 7 DIAS --- */
.forecast-section {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}

.forecast-card {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    border-radius: var(--rounded-md);
    padding: var(--space-md) var(--space-sm);
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.forecast-card:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05) translateY(-4px);
    border-color: var(--primary);
}

body.dark .forecast-card:hover {
    background: rgba(25, 35, 45, 0.9);
}

.fc-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}

.fc-icon {
    font-size: 2.2rem;
    margin: var(--space-sm) 0;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.fc-temps {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: baseline;
}

.fc-temp-max {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

.fc-temp-min {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* --- SKELETON ANIMATIONS & STYLES --- */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(150, 150, 150, 0.1) 25%, 
        rgba(150, 150, 150, 0.2) 37%, 
        rgba(150, 150, 150, 0.1) 63%
    );
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: var(--rounded-sm);
}

body.dark .skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.12) 37%, 
        rgba(255, 255, 255, 0.05) 63%
    );
    background-size: 400% 100%;
}

.skeleton-title {
    width: 40%;
    height: 18px;
    margin-bottom: 12px;
}

.skeleton-temp {
    width: 60%;
    height: 70px;
    margin-bottom: 15px;
}

.skeleton-text {
    width: 80%;
    height: 14px;
}

.skeleton-text-short {
    width: 50%;
    height: 14px;
    margin-bottom: 12px;
}

.skeleton-tag {
    width: 35%;
    height: 14px;
    margin-bottom: 20px;
}

.skeleton-temp-card {
    width: 70%;
    height: 40px;
    margin-bottom: 15px;
}

.skeleton-date {
    width: 60%;
    height: 14px;
    margin: 0 auto 12px;
}

.skeleton-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 12px;
}

.skeleton-temp-fc {
    width: 70%;
    height: 16px;
    margin: 0 auto;
}

.detail-grid-skeleton {
    border-top: 1px solid var(--border);
    padding-top: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line {
    width: 100%;
    height: 12px;
}

.skeleton-bar {
    flex: 1;
    border-radius: var(--rounded-sm) var(--rounded-sm) 0 0;
}

/* --- FOOTER --- */
footer {
    text-align: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1.5px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    animation: fadeIn 1s ease forwards;
}

footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* --- ANIMATIONS KEYFRAMES --- */
@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- RESPONSIVIDADE (MOBILE FIRST) --- */
@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
    }

    body {
        padding: var(--space-md) var(--space-sm);
    }

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

    .hero-left {
        padding: var(--space-lg);
        min-height: 200px;
    }

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

    .hero-unit {
        font-size: 2.15rem;
    }

    .city-title-box h1 {
        font-size: 1.6rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .btn-sync {
        flex: 1;
        justify-content: center;
    }

    .radar-wrapper {
        height: 280px;
    }
}

/* Suporte à redução de movimento */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}
