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

:root {
    --primary-color: #4A90E2;
    --secondary-color: #50C878;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 100px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.6s ease-out;
}

.header h1 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.last-update {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Temperatura Principal */
.main-temp {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.temp-display {
    font-size: 5rem;
    font-weight: 300;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 10px;
}

.temp-display span {
    position: relative;
}

.temp-display span::after {
    content: '°C';
    font-size: 2.5rem;
    vertical-align: super;
    margin-left: 5px;
}

.temp-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.today-extremes {
    margin-top: 8px;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.today-updated {
    margin-top: 2px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Condiciones Meteorológicas */
.weather-conditions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.condition-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.condition-card:active {
    transform: scale(0.95);
}

.condition-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}


.condition-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.condition-label.sub {
    margin-top: 4px;
}

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

.mini-stats {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.mini-stat {
    background: rgba(0,0,0,0.05);
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.75rem;
    display: inline-flex;
    gap: 4px;
    align-items: baseline;
}

.mini-label { color: var(--text-secondary); }
.mini-value { color: var(--text-primary); font-weight: 700; }

/* Estadísticas */
.stats-section {
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.stats-section h2 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Gráfico */
.chart-section {
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.chart-section h2 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chart-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    min-height: 200px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 150px;
    margin-bottom: 10px;
}

.chart-bar {
    flex: 1;
    margin: 0 3px;
    background: linear-gradient(to top, var(--primary-color), var(--secondary-color));
    border-radius: 5px 5px 0 0;
    position: relative;
    transition: all 0.3s ease;
    min-height: 20px;
}

.chart-bar:hover {
    opacity: 0.8;
}

.bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.chart-labels {
    display: flex;
    justify-content: space-around;
}

.chart-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    flex: 1;
}

/* Lista diaria 15 días */
.daily-list-section {
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease-out 0.45s both;
}

.daily-list-section h2 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.daily-slider {
    position: relative;
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 14px 40px; /* espacio para flechas */
}

.daily-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.daily-track::-webkit-scrollbar {
    height: 6px;
}
.daily-track::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.day-card {
    flex: 0 0 140px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 10px;
    scroll-snap-align: start;
}

.day-date {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.day-row {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin: 2px 0;
}

.day-row .lbl { color: var(--text-secondary); font-weight: 600; }
.day-row .val { color: var(--text-primary); }
.day-row .val.hot { color: #e67e22; }
.day-row .val.cold { color: #3498db; }

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    box-shadow: 0 6px 12px rgba(0,0,0,0.18);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    z-index: 5;
}

.slider-btn.prev { left: 8px; }
.slider-btn.next { right: 8px; }
.slider-btn:disabled { opacity: 0.35; cursor: default; }

/* Botón de actualizar */
.refresh-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    z-index: 100;
}

.refresh-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.refresh-icon {
    font-size: 1.2rem;
    transition: transform 0.6s ease;
}

.refresh-btn.rotating .refresh-icon {
    animation: rotate 1s linear infinite;
}

/* Error Message */
.error-message {
    background: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    box-shadow: var(--shadow);
    animation: shake 0.5s ease;
}

/* Footer logo */
.footer-logo {
    margin: 30px auto 10px;
    text-align: center;
}

.footer-logo img {
    max-width: 180px;
    width: 50%;
    min-width: 120px;
    height: auto;
    opacity: 0.9;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12));
}

/* Loading */
.loading {
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

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

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

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

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Responsive */
@media (max-width: 400px) {
    .container {
        padding: 15px;
    }
    
    .temp-display {
        font-size: 4rem;
    }
    
    .weather-conditions {
        gap: 10px;
    }
    
    .condition-card {
        padding: 15px 5px;
    }
    
    .condition-icon {
        font-size: 1.5rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: rgba(44, 62, 80, 0.95);
        --text-primary: #ecf0f1;
        --text-secondary: #bdc3c7;
    }
}
