
/* ==========================================
   WEATHER WIDGET MODERNO
   Design Clean com suporte a temas
   ========================================== */

/* ===== VARIÁVEIS GLOBAIS ===== */
:root {
    /* Tema Claro (padrão) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --border-light: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
}

/* Tema Escuro */
[data-bs-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --accent-primary: #60a5fa;
    --accent-secondary: #a78bfa;
    --border-light: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* ===== RESET E ESTILOS BASE ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== SELECT CLIMA ===== */

#city-selector {
    border-radius: 12px;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

#city-selector:focus {
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.25);
    border-color: #0d6efd;
}

/* Dark mode automático */
body.dark-mode #city-selector,
[data-bs-theme="dark"] #city-selector {
    background-color: #1e1e2f;
    color: #f1f1f1;
    border-color: #444;
}

body.dark-mode #city-selector:focus,
[data-bs-theme="dark"] #city-selector:focus {
    border-color: #4dabf7;
    box-shadow: 0 0 0 0.15rem rgba(77, 171, 247, 0.25);
}

#city-selector {
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 0.9rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

#city-selector:hover {
    background-color: #e9ecef;
}

[data-bs-theme="dark"] #city-selector {
    background-color: #2b2b3c;
    border: 1px solid #444;
    color: #fff;
}

/* ===== MODAL CUSTOMIZADO ===== */
.modal-content {
    background: transparent;
    border: none;
}

.modal-dialog {
    max-width: 700px;
}

.modal.fade .modal-dialog {
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal.show .modal-dialog {
    transform: scale(1);
}

.btn-close {
    background: transparent;
    opacity: 0.8;
    filter: invert(var(--invert-value, 0));
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
}

/* ===== WEATHER WIDGET PRINCIPAL ===== */
.weather-widget {
    background: var(--bg-primary);
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
    animation: slideUp 0.5s ease-out;
}

.weather-widget:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 20px 25px -5px rgba(59, 130, 246, 0.2);
}

/* ===== HEADER DO WIDGET ===== */
.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.weather-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.weather-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    background: var(--bg-tertiary);
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 0.9rem;
}

.weather-location i {
    color: var(--accent-primary);
    font-size: 1rem;
}

/* ===== ÁREA DO CLIMA ATUAL ===== */
.weather-current {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    padding: 28px;
    background: var(--bg-primary);
}

.weather-icon-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 24px;
    padding: 24px;
    min-width: 140px;
}

.weather-icon-large i {
    font-size: 5rem;
    color: white;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.2));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.weather-temp-large {
    font-size: 1rem;
    font-weight: 500;
    color: white;
    margin-top: 12px;
    opacity: 0.9;
}

.weather-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weather-temp-main {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
    letter-spacing: -0.03em;
}

.weather-description {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: capitalize;
}

/* ===== ESTATÍSTICAS DO CLIMA ===== */
.weather-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.weather-stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 16px;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
}

.weather-stat-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.weather-stat-item i {
    font-size: 1.3rem;
    color: var(--accent-primary);
}

.weather-stat-info {
    display: flex;
    flex-direction: column;
}

.weather-stat-label {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.weather-stat-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

/* ===== PREVISÃO POR HORA ===== */
.weather-hourly {
    padding: 24px 28px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.weather-hourly h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.weather-hourly h4 i {
    color: var(--accent-primary);
}

.hourly-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 4px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--border-light);
}

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

.hourly-scroll::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 10px;
}

.hourly-scroll::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}

.hourly-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
    padding: 16px 12px;
    background: var(--bg-primary);
    border-radius: 20px;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
}

.hourly-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

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

.hourly-item i {
    font-size: 1.8rem;
    color: var(--accent-primary);
    margin: 8px 0;
}

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

.hourly-desc {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-align: center;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== PREVISÃO DE 5 DIAS ===== */
.weather-forecast {
    padding: 24px 28px 28px;
    background: var(--bg-primary);
}

.weather-forecast h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.weather-forecast h4 i {
    color: var(--accent-primary);
}

.forecast-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.forecast-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border-radius: 16px;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
    cursor: default;
}

.forecast-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
    border-color: var(--accent-primary);
}

.forecast-day {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-transform: capitalize;
}

.forecast-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.forecast-icon i {
    font-size: 1.6rem;
    color: var(--accent-primary);
}

.forecast-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: capitalize;
}

.forecast-temp {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.forecast-temp-max {
    color: var(--text-primary);
    font-weight: 600;
}

.forecast-temp-min {
    color: var(--text-tertiary);
}

.forecast-temp i {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ===== LOADING SKELETON ===== */
.weather-skeleton {
    padding: 28px;
}

.skeleton-item {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 12px;
    height: 60px;
    margin-bottom: 12px;
}

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

/* ===== ANIMAÇÕES ===== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.forecast-item {
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
}

.forecast-item:nth-child(1) { animation-delay: 0.05s; }
.forecast-item:nth-child(2) { animation-delay: 0.1s; }
.forecast-item:nth-child(3) { animation-delay: 0.15s; }
.forecast-item:nth-child(4) { animation-delay: 0.2s; }
.forecast-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
    }
    
    .weather-header {
        padding: 18px 20px;
    }
    
    .weather-header h3 {
        font-size: 1.2rem;
    }
    
    .weather-location {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .weather-current {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px;
    }
    
    .weather-icon-large {
        flex-direction: row;
        justify-content: space-around;
        padding: 16px;
    }
    
    .weather-icon-large i {
        font-size: 4rem;
    }
    
    .weather-temp-main {
        font-size: 3.2rem;
    }
    
    .weather-description {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }
    
    .weather-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .weather-hourly,
    .weather-forecast {
        padding: 18px 20px;
    }
    
    .hourly-item {
        min-width: 60px;
        padding: 12px 8px;
    }
    
    .forecast-item {
        grid-template-columns: 70px 1fr auto;
        padding: 12px 14px;
        gap: 8px;
    }
    
    .forecast-icon {
        gap: 6px;
    }
    
    .forecast-icon i {
        font-size: 1.3rem;
    }
    
    .forecast-desc {
        font-size: 0.8rem;
        max-width: 100px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .forecast-temp {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .weather-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .forecast-desc {
        display: none;
    }
    
    .forecast-item {
        grid-template-columns: 70px auto;
    }
    
    .forecast-icon i {
        margin-right: 0;
    }
}

/* ===== AJUSTES PARA TEMA ESCURO ===== */
[data-bs-theme="dark"] .btn-close {
    filter: invert(1);
}

[data-bs-theme="dark"] .weather-stat-item i,
[data-bs-theme="dark"] .hourly-item i,
[data-bs-theme="dark"] .forecast-icon i {
    color: var(--accent-secondary);
}

[data-bs-theme="dark"] .weather-icon-large {
    background: linear-gradient(135deg, #1e40af 0%, #6b21a8 100%);
}
