:root {
    /* Paleta Principal */
    --color-primario-inicio: #667eea;
    --color-primario-fin: #764ba2;
    --gradiente-principal: linear-gradient(135deg, var(--color-primario-inicio) 0%, var(--color-primario-fin) 100%);

    /* Paleta Secundaria (Clima por hora) */
    --color-secundario-inicio: #4facfe;
    --color-secundario-fin: #00f2fe;
    --gradiente-secundario: linear-gradient(135deg, var(--color-secundario-inicio) 0%, var(--color-secundario-fin) 100%);

    /* Colores de Fondo y Superficie */
    --color-fondo-pagina: var(--gradiente-principal);
    --color-superficie: white; /* Para las cards principales */
    --color-superficie-alt: #f8f9fa; /* Para cards internas o de noticias */
    
    /* Colores de Texto */
    --color-texto-principal: #333;
    --color-texto-secundario: #666;
    --color-texto-desactivado: #999;
    --color-texto-sobre-primario: white;
    
    /* Colores de Borde y Acentos */
    --color-borde: #e0e0e0;
    --color-acento-primario: var(--color-primario-inicio);
    --color-error: #ff6b6b;

    /* Sombras y Bordes */
    --sombra-card: 0 10px 30px rgba(0,0,0,0.3);
    --radio-borde: 15px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradiente-principal);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.search-box {
    background: var(--color-superficie);
    padding: 20px;
    border-radius: var(--radio-borde);
    box-shadow: var(--sombra-card);
    margin-bottom: 20px;
}

.search-input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

input[type="text"] {
    flex: 1;
    min-width: 150px; /* <--- ESTÁ MEJOR */
    padding: 15px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 15px 30px;
    font-size: 16px;
    background: var(--gradiente-principal);
    color: var(--color-texto-sobre-primario);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
    font-weight: bold;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.quick-cities {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.quick-city-btn {
    padding: 8px 16px;
    font-size: 14px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-city-btn:hover {
    background: #667eea;
    color: white;
}

.current-weather {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.current-main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.current-temp {
    font-size: 4em;
    font-weight: bold;
    color: #667eea;
}

.current-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.detail-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.detail-label {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.wind-direction {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin: 10px auto;
}

#map {
    height: 400px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.forecast-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.forecast-title {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #333;
}

.forecast-grid {
    display: grid;
    /* Cambia 'auto-fill' por 'auto-fit' */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.forecast-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s;
}

.forecast-card:hover {
    transform: translateY(-5px);
}

.forecast-date {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 14px;
}

.forecast-temp {
    font-size: 28px;
    font-weight: bold;
    margin: 10px 0;
}

.forecast-icon {
    font-size: 40px;
    margin: 10px 0;
}

.forecast-detail {
    font-size: 12px;
    margin: 5px 0;
    opacity: 0.9;
}

.forecast-wind-arrow {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 3px;
}

.hourly-forecast {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.hourly-title {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #333;
}

.hourly-scroll {
    overflow-x: auto;
    padding-bottom: 10px;
}

.hourly-grid {
    display: flex;
    gap: 15px;
    min-width: min-content;
}

.hourly-card {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    min-width: 100px;
    transition: transform 0.3s;
}

.hourly-card:hover {
    transform: translateY(-3px);
}

.hourly-time {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
}

.hourly-icon {
    font-size: 32px;
    margin: 8px 0;
}

.hourly-temp {
    font-size: 20px;
    font-weight: bold;
    margin: 8px 0;
}

.hourly-rain {
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.95;
}

.hourly-wind-arrow {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 3px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: white;
    font-size: 1.5em;
}

.error {
    background: #ff6b6b;
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }

    .current-temp {
        font-size: 3em;
    }

    .forecast-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Estilos de Noticias */
.news-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-top: 20px;
}

.news-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.news-title {
    font-size: 1.8em;
    color: #333;
    margin: 0;
}

.category-section {
    margin-bottom: 30px;
}

.category-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: bold;
}

.news-grid {
    display: grid;
    /* Cambia 'auto-fill' por 'auto-fit' */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.news-card {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    border-color: #667eea;
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.news-content {
    padding: 20px;
}

.news-card-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em;
}

.news-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.news-source {
    font-weight: bold;
    color: #667eea;
}


/* --- Estilos del Nuevo Layout Dinámico --- */

/* 2. Barra de Navegación */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.nav-link {
    background: var(--color-superficie);
    color: var(--color-acento-primario);
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    border: 2px solid transparent;
    transition: all 0.3s;
}
.nav-link:hover, .nav-link.active {
    background: var(--color-primario-inicio);
    color: var(--color-texto-sobre-primario);
    border-color: var(--color-primario-fin);
    transform: translateY(-2px);
}

/* 3. Contenedor Principal (Centrado) */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px; 
}

/* 3.2. Grilla de Contenido Principal */
.content-grid {
    display: grid;
    /* Columnas: 1fr (chica) - 3fr (grande) - 1fr (chica) */
    grid-template-columns: 1fr 3fr 1fr;
    grid-template-areas: 
        "hobbies main sponsors";
    gap: 20px;
}

.sidebar-left {
    grid-area: hobbies;
}

.main-content-column {
    grid-area: main;
    min-width: 0; 
}

.sidebar-right {
    grid-area: sponsors;
}

/* Placeholder de Publicidad */
.ad-placeholder {
    background: var(--color-superficie);
    border-radius: var(--radio-borde);
    padding: 20px;
    box-shadow: var(--sombra-card);
    text-align: center;
    color: var(--color-texto-secundario);
    margin-bottom: 20px;
}
.ad-placeholder h4 {
    color: var(--color-texto-principal);
    margin-bottom: 10px;
    border-bottom: 2px solid var(--color-borde);
    padding-bottom: 10px;
}

/* --- Responsividad del Nuevo Layout --- */
@media (max-width: 900px) {
    .content-grid {
        /* Volvemos a 1 columna */
        grid-template-columns: 1fr;
        grid-template-areas: 
            "main"
            "hobbies"
            "sponsors";
    }
}

/* Estilo para la fecha en el header */
.header-date {
    font-size: 1.1em;
    font-weight: 500;
    color: white;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    margin-top: -10px; /* Ajusta el espacio con el H1 */
    margin-bottom: 10px;
}