/* Importar la fuente Inter de Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Estilos generales del cuerpo */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    /* Fondo verde inspirado en el Gran Chaco */
    background: linear-gradient(to bottom right, #3A7D44, #5CA469); /* Verde más oscuro a más claro */
    color: #f0fdf4; /* Texto claro para contrastar con el fondo oscuro */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Centra el contenido verticalmente */
    min-height: 100vh;
    box-sizing: border-box;
}

/* Estilos del banner */
.banner {
    width: 100%;
    max-height: 350px;
    overflow: hidden;
    margin-bottom: 30px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); /* Sombra más pronunciada para destacar */
}

.banner img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
}

/* Contenedor principal del formulario y resultados */
.container {
    background-color: #ffffff; /* Fondo blanco para el formulario */
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); /* Sombra más fuerte para que resalte */
    width: 90%;
    max-width: 650px;
    margin: 30px auto; /* Centra horizontalmente y añade margen vertical */
    text-align: center;
    box-sizing: border-box; /* Asegura el padding y borde */
}

/* Estilos para el título principal */
h1 {
    color: #1A5222; /* Un verde oscuro y elegante */
    font-size: 1.8em;
    margin-bottom: 15px;
    font-weight: 700;
}

/* Estilos para el párrafo descriptivo */
p {
    color: #4a4a4a; /* Un gris oscuro, que combina bien con el blanco del contenedor */
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Estilos del formulario */
form {
    display: flex; /* Cambiado a flex para control de los elementos */
    flex-direction: column;
    gap: 20px;
}

/* Estilos para las etiquetas */
label {
    text-align: left;
    margin-bottom: 5px;
    color: #333; /* Texto oscuro para la etiqueta */
    font-weight: 600; /* Más negrita para destacar */
    font-size: 1.05em;
}

/* Estilos para los campos de entrada */
input[type="text"] {
    padding: 14px 18px;
    border: 2px solid #a7f3d0; /* Borde verde claro */
    border-radius: 8px;
    font-size: 1.1em;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    color: #333; /* Color de texto para el input */
}

input[type="text"]:focus {
    border-color: #10b981;
    outline: none;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.4); /* Sombra de enfoque más prominente */
}

/* Estilos para el botón */
button[type="submit"], .back-button {
    background-color: #10b981; /* Verde esmeralda */
    color: white;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
    text-decoration: none;
    display: inline-block;
    margin-top: 20px;
    align-self: center;
    max-width: fit-content;
}

button[type="submit"]:hover, .back-button:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

button[type="submit"]:active, .back-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.5);
}

/* Estilos para la sección de resultados del beneficiario */
.beneficiary-details {
    text-align: left;
    margin-top: 30px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 25px;
    background-color: #f8fafc;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08); /* Sombra interior sutil */
}

.beneficiary-details h2 {
    color: #065f46;
    font-size: 1.4em;
    margin-bottom: 20px;
    border-bottom: 2px solid #a7f3d0;
    padding-bottom: 10px;
}

.beneficiary-details p {
    margin-bottom: 12px;
    font-size: 1.05em;
    color: #333;
    line-height: 1.5;
    text-align: left;
}

.beneficiary-details p strong {
    color: #16a34a;
    display: inline-block;
    min-width: 120px;
}

.error-message {
    color: #dc2626;
    font-weight: 600;
    margin-top: 20px;
    font-size: 1.1em;
}

/* Estilos para el estado del beneficio */
.status-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.2em;
    margin-top: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.status-display.active {
    background-color: #dcfce7;
    color: #16a34a;
    border: 1px solid #86efac;
}

.status-display.pending {
    background-color: #fffbeb;
    color: #f59e0b;
    border: 1px solid #fcd34d;
}

.status-display.inactive {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #ef4444;
}

.status-display svg {
    margin-right: 10px;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* --- Estilos del Modal de Advertencia --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7); /* Fondo modal más oscuro para mayor contraste */
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out forwards;
}

.modal-content {
    background-color: #ffffff;
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4); /* Sombra más fuerte para el modal */
    width: 90%;
    max-width: 450px;
    position: relative;
    text-align: center;
    animation: slideIn 0.3s ease-out forwards;
}

.modal-content h2 {
    color: #c02a2a; /* Rojo un poco más oscuro */
    font-size: 1.8em;
    margin-bottom: 15px;
    font-weight: 700;
}

.modal-content p {
    color: #4a4a4a;
    font-size: 1.1em;
    line-height: 1.5;
    margin-bottom: 25px;
}

.close-button {
    color: #777; /* Gris más oscuro para el botón de cerrar */
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #000; /* Negro al pasar el ratón */
    text-decoration: none;
}

.modal-button {
    background-color: #ef4444;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.modal-button:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.modal-button:active {
    transform: translateY(0);
}

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

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

/* Media queries para responsividad (manteniendo las existentes y ajustando modal) */
@media (max-width: 768px) {
    .banner {
        max-height: 180px;
        margin-bottom: 20px;
    }

    .container {
        padding: 30px;
        width: 95%;
        margin: 20px auto; /* Ajuste el margen para móviles */
    }

    h1 {
        font-size: 2em;
    }

    p {
        font-size: 1em;
        margin-bottom: 25px;
    }

    input[type="text"] {
        font-size: 1em;
        padding: 12px 15px;
    }

    button[type="submit"], .back-button {
        font-size: 1.1em;
        padding: 12px 20px;
    }

    .beneficiary-details {
        padding: 20px;
    }

    .beneficiary-details h2 {
        font-size: 1.6em;
    }

    .beneficiary-details p {
        font-size: 0.95em;
    }

    .status-display {
        font-size: 1.1em;
        padding: 12px 15px;
    }

    .modal-content {
        padding: 25px;
    }
    .modal-content h2 {
        font-size: 1.6em;
    }
    .modal-content p {
        font-size: 1em;
    }
    .modal-button {
        padding: 10px 20px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .banner {
        max-height: 150px;
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
    }
    .container {
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        margin: 15px auto; /* Un poco menos margen para pantallas muy pequeñas */
    }
    h1 {
        font-size: 1.8em;
    }
    p {
        font-size: 0.95em;
        margin-bottom: 20px;
    }
    form {
        gap: 15px;
    }
    input[type="text"] {
        padding: 10px 12px;
    }
    button[type="submit"], .back-button {
        padding: 12px 20px;
        font-size: 1em;
    }
    .beneficiary-details p strong {
        min-width: 80px;
        display: block;
        margin-bottom: 5px;
    }
    .status-display {
        flex-direction: column;
        text-align: center;
        padding: 10px 15px;
    }
    .status-display svg {
        margin-right: 0;
        margin-bottom: 5px;
    }

    .modal-content {
        padding: 20px;
        border-radius: 10px;
    }
    .modal-content h2 {
        font-size: 1.5em;
    }
    .modal-content p {
        font-size: 0.95em;
    }
    .close-button {
        font-size: 24px;
        top: 10px;
        right: 15px;
    }
}

/* === Estilos específicos para “Rol de Farmacias de Turno” === */

.toolbar {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.date-input,
.search-input {
    padding: 12px 14px;
    border: 2px solid #a7f3d0;
    border-radius: 8px;
    font-size: 1.05em;
    color: #333;
    width: 100%;
    box-sizing: border-box;
}

.nav-btn {
    background-color: #10b981;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
    transition: background-color .2s, transform .2s;
}

.nav-btn:hover { background-color: #059669; transform: translateY(-1px); }

.result-day {
    margin: 28px 0 16px;
    padding-bottom: 6px;
    border-bottom: 2px solid #a7f3d0;
    color: #065f46;
    font-weight: 700;
}

.card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
    background: #f8fafc;
    border: 2px solid #10b981; /* Verde esmeralda */
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.card h3 {
    margin: 0 0 6px 0;
    color: #1A5222;
    font-size: 1.1rem;
}

.card h2 {
    margin: 0 0 6px 0;
    color: #1A5222;
    font-size: 2.1rem;
}

.card p { margin: 4px 0; color: #333; }

.pharmacy-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    object-fit: cover;
    background: #e5f7ee; /* placeholder */
    display: block;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.badge {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
}

.map-wrap {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-top: 10px;
}

.map-wrap iframe {
    display: block;
    width: 100%;
    height: 120px; /* mini vista */
    border: 0;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.actions a {
    background-color: #10b981;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.actions a:hover {
    background-color: #059669;
}

/* Responsive */
@media (max-width: 640px) {
    .toolbar { grid-template-columns: 1fr; }
    .card { grid-template-columns: 1fr; }
    .map-wrap iframe { height: 220px; }
}
