/* =========================================
   1. RESET Y ESTILOS GLOBALES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #ffffff; /* --- CAMBIO: Fondo Blanco Limpio --- */
    color: #1a1a1a;          /* --- CAMBIO: Texto Negro casi puro --- */
}

/* =========================================
   2. NAVEGACIÓN (Navbar)
   ========================================= */
.navbar {
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    border-bottom: 3px solid #b71c1c; /* Acento Rojo */
    position: relative;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1a1a1a;
}

.highlight {
    color: #b71c1c;
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #b71c1c;
    border-radius: 3px;
    transition: 0.3s;
}

.nav-links {
    list-style: none;
    display: none;
    flex-direction: column;
    position: absolute;
    top: 70px;
    right: 5%;
    background: #ffffff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.nav-links.active {
    display: flex;
}

.nav-links a {
    text-decoration: none;
    color: #1a1a1a;
    padding: 12px 20px;
    display: block;
    font-weight: 500;
}

.nav-links a:hover {
    background: #fce4e4;
    color: #b71c1c;
}

/* =========================================
   3. CONTENEDOR PRINCIPAL Y DASHBOARD (Index)
   ========================================= */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.main-header {
    text-align: center;
    margin-bottom: 50px;
    color: #1a1a1a;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.card {
    background: #ffffff;
    padding: 30px;
    text-align: center;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    transition: 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.card:hover {
    transform: translateY(-8px);
    border-color: #b71c1c;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.card-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: block;
}

/* Títulos dentro de cards */
.card h3 {
    color: #1a1a1a;
    margin-bottom: 10px;
}

/* Textos dentro de cards */
.card p {
    color: #555555;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
}

/* Botones Comunes */
.btn-red, .btn-save {
    display: block;
    background: #b71c1c;
    color: #ffffff;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-red:hover, .btn-save:hover {
    background: #8e1616;
}

/* =========================================
   4. CRUD LAYOUT Y TABLAS
   ========================================= */
.crud-layout {
    display: flex;
    gap: 30px;
    margin: 30px auto;
    max-width: 1300px;
    padding: 0 20px;
    align-items: flex-start;
}

.form-container, .table-container {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.form-container { flex: 1; }
.table-container { flex: 2; }

.form-title {
    color: #b71c1c;
    text-align: center;
    margin-bottom: 25px;
}

.form-table {
    width: 100%;
    border-spacing: 0 10px;
}

.form-table label {
    color: #1a1a1a;
    font-weight: 500;
}

.form-table input, .form-table select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #ffffff;
    color: #1a1a1a;
}

.form-table input:focus, .form-table select:focus {
    outline: none;
    border-color: #b71c1c;
}

.btn-secondary {
    display: inline-block;
    background: #757575;
    color: #ffffff;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #b71c1c;
    color: #ffffff;
    padding: 15px;
    text-align: left;
    text-transform: uppercase;
    font-size: 13px;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f1f1;
    color: #1a1a1a;
}

/* =========================================
   5. MODALES (Overlay y Content)
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* --- CAMBIO: Fondo más oscuro para contraste --- */
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* Clase para activar el modal (requerido por JS) */
.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    color: #1a1a1a;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.profile-item {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.profile-item label {
    display: block;
    color: #888;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
}

.profile-item span {
    color: #1a1a1a;
    font-weight: 500;
}

/* =========================================
   6. BUSCADOR Y ESTUDIANTES (Directorio)
   ========================================= */
.search-container {
    padding: 20px;
    max-width: 900px;
    margin: 40px auto;
}

.search-input {
    width: 100%;
    padding: 15px 25px;
    border-radius: 30px;
    border: 2px solid #eee;
    font-size: 1.1rem;
    transition: 0.3s;
    outline: none;
    background: #ffffff;
    color: #1a1a1a;
}

.search-input:focus {
    border-color: #b71c1c;
    box-shadow: 0 0 10px rgba(183, 28, 28, 0.1);
}

.student-card {
    display: none !important; /* Requerido por lógica de búsqueda */
    background: #ffffff;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    border-left: 6px solid #e0e0e0;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.student-card.visible {
    display: flex !important;
}

.student-card:hover {
    border-left-color: #b71c1c;
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    background: #fffafa;
}

.student-info h4 {
    color: #1a1a1a;
    margin-bottom: 5px;
}

.student-info p {
    color: #666666;
    font-size: 0.9rem;
}

/* =========================================
   7. SECCIÓN LOGIN (Nueva imagen de referencia)
   ========================================= */
.login-body {
    background-color: #ffffff; /* --- CAMBIO: Fondo Blanco --- */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    color: #1a1a1a;
}

.login-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1); /* Sombra más suave sobre blanco */
    border: 1px solid #eeeeee;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-title {
    color: #b71c1c;
    margin-bottom: 25px;
    font-size: 1.8rem;
    font-weight: bold;
}

.login-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    background: #ffffff;
    color: #1a1a1a;
}

.login-input:focus {
    outline: none;
    border-color: #b71c1c;
}

.btn-login {
    width: 100%;
    background: #b71c1c;
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.btn-login:hover {
    background: #8e1616;
}

.error-msg {
    color: #d32f2f;
    background: #fdecea;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.login-footer {
    color: #888888;
    margin-top: 25px;
    font-size: 0.8rem;
}

/* =========================================
   8. FOOTER GENERAL
   ========================================= */
.footer {
    text-align: center;
    padding: 40px;
    color: #888888;
    font-size: 14px;
    background: #fafafa;
    border-top: 1px solid #eeeeee;
}
/* --- DISEÑO RESPONSIVO (Móviles y Tablets) --- */

@media (max-width: 768px) {
    /* El layout pasa de 2 columnas a 1 sola columna */
    .crud-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 10px;
    }

    /* El formulario y la tabla ocupan el 100% del ancho */
    .form-container, .table-container {
        width: 100% !important;
        max-width: 100%;
        margin: 0 auto;
    }

    /* Reducimos el tamaño de la tabla para que no se rompa */
    .data-table {
        font-size: 0.85rem; /* Letra un poco más pequeña */
    }

    .data-table thead th, 
    .data-table tbody td {
        padding: 10px 5px; /* Menos espacio interno */
    }

    /* Ajuste para que los inputs no se salgan del borde */
    input, select, button {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* El contenedor de la tabla permite scroll horizontal si es muy ancha */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Ajuste extra para celulares muy pequeños */
@media (max-width: 480px) {
    .navbar .logo {
        font-size: 1.2rem;
    }
    
    .form-title {
        font-size: 1.1rem;
    }

    /* Ocultamos columnas menos importantes si hay poco espacio (opcional) */
    /* .data-table th:nth-child(2), .data-table td:nth-child(2) { display: none; } */
}
