/* ==========================================
   1. RESET Y ESTILOS GENERALES
   ================================---------- */
* { 
    box-sizing: border-box; 
}
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    /* Fondo con un degradado moderno y elegante (azul suave hacia un gris/azulado sutil) */
    background: linear-gradient(135deg, #e0f2fe 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-attachment: fixed; /* Mantiene el degradado fijo al hacer scroll */
    min-height: 100vh;
}

/* ==========================================
   2. HEADER Y NAVEGACIÓN MODERNA
   ================================---------- */
header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    /* Degradado de izquierda (más claro y azul) a derecha (más oscuro) */
    background: linear-gradient(90deg, #90d5f3c9 0%, #3397c9 50%, #0f172a 100%);
    color: white; 
    padding: 15px 30px; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-logo {
    display: flex;
    align-items: center;
}

header nav {
    display: flex;
    gap: 12px;
}

/* Estilo general para los botones del header */
.header-btn, .logout-btn { 
    color: white; 
    text-decoration: none; 
    padding: 8px 16px; 
    border-radius: 6px; 
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease; 
    display: inline-block;
}

/* Botón de Inicio */
.btn-inicio {
    background: rgba(255, 255, 255, 0.2); 
}
.btn-inicio:hover { 
    background: rgba(255, 255, 255, 0.3); 
    transform: translateY(-1px);
}

/* Botón de Cerrar Sesión */
.logout-btn { 
    background: #ef4444; 
}
.logout-btn:hover { 
    background: #dc2626; 
    transform: translateY(-1px);
}

/* ==========================================
   3. VISTAS PRINCIPALES Y LOGIN
   ================================---------- */
main { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    height: 80vh; 
    text-align: center; 
}
.logo-placeholder { 
    width: 300px; 
    height: 300px; 
    background: #ddd; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 40px; 
    border-radius: 50%; 
    color: #666; 
    font-weight: bold; 
}
.menu-buttons { 
    display: flex; 
    gap: 20px; 
}
.btn { 
    padding: 15px 40px; 
    font-size: 18px; 
    text-decoration: none; 
    color: white; 
    border-radius: 8px; 
    transition: background 0.3s; 
}
.btn-calendar { background: #28a745; }
.btn-calendar:hover { background: #218838; }
.btn-register { background: #007bff; }
.btn-register:hover { background: #0069d9; }

/* Estilos Modernos para el Login */
.login-body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f4f7f6;
}

.login-container {
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-form h2 {
    margin-bottom: 5px;
    color: #333;
}

.login-form p {
    color: #777;
    margin-bottom: 25px;
    font-size: 14px;
}

.error-msg {
    color: #d9534f;
    background: #fdf2f2;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 15px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: #007bff;
    outline: none;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.login-btn:hover {
    background: #0056b3;
}

/* Formularios estándar (Fuera del modal) */
main form:not(.login-form) { 
    background: white; 
    padding: 25px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    width: 350px; 
}
main form:not(.login-form) input, main form:not(.login-form) select, main form:not(.login-form) textarea { 
    width: 100%; 
    padding: 10px; 
    margin: 10px 0; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
}
.form-btn { 
    width: 100%; 
    padding: 10px; 
    background: #007bff; 
    color: white; 
    border: none; 
    cursor: pointer; 
    border-radius: 4px; 
}
.form-btn:hover { background: #0069d9; }

/* ==========================================
   4. CALENDARIO
   ================================---------- */
.calendar-wrapper { 
    padding: 20px; 
    height: 85vh; 
}
#calendar { 
    background: white; 
    padding: 20px; 
    border-radius: 8px; 
    height: 100%; 
}

/* ==========================================
   5. MODAL DE EVENTOS ( AMPLIADO Y PROPORCIONAL )
   ================================---------- */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    overflow-y: auto; 
}

.modal-content { 
    background: white; 
    margin: 3% auto; 
    padding: 28px; 
    width: 600px; 
    border-radius: 10px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.25); 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    position: relative; 
}

.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 16px; 
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 10px;
}

.modal-header h2 { 
    margin: 0; 
    font-size: 20px; 
    color: #333; 
}

.modal-content .close { 
    cursor: pointer; 
    font-size: 26px; 
    color: #555; 
    background: none; 
    border: none; 
    float: none;
}
.modal-content .close:hover { 
    color: #000; 
}

/* Estructura interna del formulario modal */
.modal form {
    background: transparent;
    padding: 0;
    box-shadow: none;
    width: 100%;
}

.form-group { 
    margin-bottom: 12px; 
}
.form-group.full { 
    width: 100%; 
}

.form-row { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 12px; 
}

/* Etiquetas y campos escalados proporcionalmente */
.modal label { 
    font-size: 14px; 
    font-weight: 600; 
    color: #444; 
    display: block; 
    margin-bottom: 4px; 
}

.modal input[type="text"], 
.modal input[type="number"], 
.modal input[type="datetime-local"], 
.modal select, 
.modal textarea { 
    width: 100%; 
    padding: 10px 14px; 
    border: 1px solid #ccc; 
    border-radius: 6px; 
    font-size: 15px; 
    margin: 0;
    background: #fff;
}

.modal textarea { 
    height: 90px; 
    resize: none; 
}

/* Enlaces auxiliares proporcionales */
.helper-link { 
    font-size: 13px; 
    color: #007bff; 
    text-decoration: none; 
    display: inline-block; 
    margin-top: 4px; 
    margin-bottom: 4px; 
}
.helper-link:hover {
    text-decoration: underline;
}

/* Botones del pie del modal */
.modal-footer { 
    display: flex; 
    justify-content: flex-end; 
    gap: 12px; 
    margin-top: 20px; 
    border-top: 1px solid #e5e5e5;
    padding-top: 14px;
}

.btn-cancel, .btn-submit { 
    padding: 9px 20px; 
    border-radius: 6px; 
    border: none; 
    cursor: pointer; 
    font-size: 15px; 
    font-weight: 600;
}
.btn-cancel { 
    background: #6c757d; 
    color: white; 
}
.btn-cancel:hover { 
    background: #5a6268; 
}
.btn-submit { 
    background: #007bff; 
    color: white; 
}
.btn-submit:hover { 
    background: #0056b3; 
}
.legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px auto;
    padding: 10px;
    background: #fdfdfd;
    border: 1px solid #ddd;
    border-radius: 8px;
    justify-content: center;
    max-width: 900px;
}

.legend-btn {
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.1s, opacity 0.2s;
    opacity: 0.85;
}

.legend-btn:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.legend-btn.active {
    opacity: 1;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333;
}

/* ==========================================
   6. NUEVOS ELEMENTOS (BOTONES Y CONSULTA)
   ================================---------- */

/* Contenedor de botones superior */
.calendar-wrapper + div {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

/* Mejora específica para el formulario de consulta */
#consultaForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#consultaForm .form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
}

#consultaForm .form-group {
    flex: 1;
    min-width: 150px; 
}

#consultaForm input[type="date"] {
    width: 100%;
    padding: 12px 14px; 
    font-size: 16px;    
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

#consultaForm .form-group.full {
    width: 100%;
}

#consultaForm .btn-submit {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    margin-top: 5px;
}
footer {
    display: flex;
    justify-content: center;
    align-items: center;
    /* Degradado azul que combina con tu header */
    background: linear-gradient(90deg, #062e8b 0%, #3397c9 50%, #062e8b 100%);
    color: #f8fafc;
    padding: 20px 30px;
    font-size: 14px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

@media (max-width: 600px) {
    #consultaForm .form-row {
        flex-direction: column;
        gap: 10px;
    }
    #consultaForm .form-group {
        min-width: 100%;
    }
}
#resultadosConsulta > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
#resultadosConsulta > div > div {
    flex: 1;
}
