body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f7f9fa;
    color: #333;
    margin: 0;
}

/* ==========================================================================
   Estilos para Layout con Banners de Publicidad
   ========================================================================== */

.page-wrapper {
    display: flex;
    justify-content: center;
    gap: 0.1rem;
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
}

.content-main {
    flex-grow: 1;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- ESTILOS DE BANNERS MODIFICADOS --- */

.ad-banner {
    width: 260px;
    flex-shrink: 0;
    margin-top: 350px; /* <-- ¡VALOR AUMENTADO! Desplaza los banners más abajo. */
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-height: 300px; /* <-- ¡NUEVO! Limita la altura máxima del banner para hacerlo más bajo. */
}

.ad-title {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    text-align: center;
    padding: 6px 0;
    font-size: 0.8em;
    font-weight: bold;
    letter-spacing: 1px;
    box-sizing: border-box;
}

.ad-banner img {
    width: 100%;
    height: 100%; /* <-- ¡MODIFICADO! Hace que la imagen intente llenar la altura del contenedor. */
    object-fit: cover; /* <-- ¡NUEVO! Asegura que la imagen cubra el espacio sin distorsionarse. */
    display: block;
    transition: opacity 0.5s ease-in-out;
}

.ad-banner img.fade-out {
    opacity: 10;
}

@media (max-width: 1300px) {
    .ad-banner {
        display: none;
    }
    .page-wrapper {
        justify-content: center;
    }
}

/* ==========================================================================
   Estilos Generales de la Página (Header, Main, Footer)
   ========================================================================== */

header {
    background-color: #00897b;
    color: white;
    padding: 1.5rem 2rem;
    border-bottom: 5px solid #4db6ac;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    max-height: 70px;
    width: auto;
}

.header-text {
    text-align: left;
}

header h1 {
    margin: 0;
    font-size: 2em;
}

header .subtitulo {
    margin: 0.2rem 0 0;
    font-style: italic;
    opacity: 0.9;
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

footer {
    text-align: center;
    padding: 1.5rem;
    background-color: #f1f1f1;
    color: #555;
    font-size: 0.85em;
    margin-top: auto;
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .header-text {
        text-align: center;
    }
    header h1 {
        font-size: 1.8em;
    }
}

/* ==========================================================================
   Estilos para la Página de Inicio (Selección de Temas)
   ========================================================================== */

.tema-container {
    background-color: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 600px;
}

.tema-container h2 {
    margin-top: 0;
    margin-bottom: 2rem;
    color: #333;
    font-weight: 500;
}

.tema-botones {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.tema-btn {
    background-color: #00796b;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0;
    font-size: 1.2em;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.tema-btn:hover {
    background-color: #004d40;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ==========================================================================
   Estilos para la Página de Búsqueda (Formulario, Imagen, etc.)
   ========================================================================== */

.search-container {
    background-color: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 550px;
    box-sizing: border-box;
}

.search-box {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.search-box input[type="date"] {
    padding: 0.7rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

button {
    background-color: #00796b;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #00695c;
}

.instrucciones {
    color: #666;
    font-size: 0.9em;
}

.date-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
}

.date-field label {
    font-size: 0.9em;
    font-weight: normal;
    color: #555;
}

.back-button {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #00796b;
    transition: all 0.3s;
    background-color: transparent;
    color: #00796b;
}

.back-button:hover {
    background-color: #00796b;
    color: white;
}

.imagen-tema-container {
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
    text-align: center;
}

.imagen-tema-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    max-height: 300px;
}

/* ==========================================================================
   Estilos de Validación y Animaciones
   ========================================================================== */

.error-message {
    color: #c0392b;
    font-size: 0.9em;
    margin-top: 15px;
    text-align: center;
    width: 100%;
}

.input-error {
    border: 2px solid #e74c3c !important;
    animation: shake 0.5s;
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

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