/* public/css/styles.css */
:root {
    /* Identidad IE Palestina */
    --primary: #0033CC;      /* Azul Institucional - Dominante */
    --primary-dark: #002288; /* Hover Azul */
    --secondary: #FFCC00;    /* Amarillo Oro - Acentos */
    --accent: #DC2626;       /* Rojo - Alertas/Logout */
    --success: #10B981;      /* Verde - Éxito */

    /* Neutros */
    --bg-body: #F3F4F6;      /* Gris muy suave para fondo */
    --bg-card: #FFFFFF;      /* Blanco puro */
    --text-main: #1F2937;    /* Gris oscuro casi negro */
    --text-muted: #6B7280;   /* Gris medio */
    --border: #E5E7EB;       /* Bordes sutiles */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

/* --- Layout Flexbox Robusto --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.h-screen { height: 100vh; overflow: hidden; } /* Fija la altura a la ventana */
.w-full { width: 100%; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; } .px-8 { padding-left: 2rem; padding-right: 2rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mt-auto { margin-top: auto; }

/* --- Sidebar Profesional --- */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    z-index: 10;
}

.brand-area {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-circle {
    width: 40px; height: 40px;
    background: var(--secondary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: var(--primary);
}
.brand-name { font-weight: 700; color: var(--primary); font-size: 1.1rem; }

.nav-menu {
    padding: 1.5rem 1rem;
    flex-grow: 1; /* Ocupa todo el espacio disponible */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.logout-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: #FAFAFA;
}

/* --- Botones de Navegación --- */
.nav-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 0.8rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 0.95rem;
}
.nav-btn:hover { background: #F3F4F6; color: var(--primary); }
.nav-btn.active {
    background: #E0E7FF; /* Azul muy claro */
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.btn-logout {
    width: 100%;
    padding: 0.8rem;
    background: #FEF2F2;
    color: var(--accent);
    border: 1px solid #FECACA;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    text-decoration: none;
    display: block;
}
.btn-logout:hover { background: #FEE2E2; }

/* --- Main Content --- */
.main-wrapper { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.top-header {
    height: 70px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 2rem;
}
.content-scroll {
    flex: 1;
    overflow-y: auto; /* Scroll solo en el contenido */
    padding: 2rem;
}

/* --- Cards y Componentes --- */
.card {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04); /* Sombra sutil */
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0,0,0,0.08); }

.card-header-strip { height: 6px; background: var(--primary); width: 100%; }
.card-body { padding: 1.5rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 6px; border: none;
    font-weight: 600; cursor: pointer; font-size: 0.9rem;
    transition: filter 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-body); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: #E5E7EB; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;}
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-red { background: #FEE2E2; color: #991B1B; }

/* Tablas */
.table-container { border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #F9FAFB; text-align: left; padding: 1rem; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; border-bottom: 1px solid var(--border); }
td { padding: 1rem; border-bottom: 1px solid var(--border); color: var(--text-main); font-size: 0.95rem; }
tr:last-child td { border-bottom: none; }

/* Inputs */
.input-control, .input-select {
    width: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: 6px;
    background: #F9FAFB; transition: border 0.2s;
}
.input-control:focus { border-color: var(--primary); background: white; outline: none; }

/* --- ESTILOS LOGIN SPLIT-SCREEN --- */

.login-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh; /* Ocupa toda la altura */
    overflow: hidden;
}

/* Lado Izquierdo (Imagen) */
.login-image-side {
    display: none; /* Oculto en móviles */
    flex: 1.2;     /* Ocupa un poco más de la mitad */
    background-image: linear-gradient(rgba(0, 51, 204, 0.85), rgba(0, 34, 136, 0.9)), url('https://images.unsplash.com/photo-1523050854058-8df90110c9f1?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    position: relative;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: white;
}

.login-image-content {
    max-width: 600px;
    z-index: 2;
}

.login-title-large {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.login-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
    line-height: 1.6;
}

/* Decoración (Círculos flotantes) */
.circle-deco {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}
.c1 { width: 200px; height: 200px; top: -50px; left: -50px; }
.c2 { width: 300px; height: 300px; bottom: -100px; right: -50px; }

.login-form-side {
    flex: 0.8;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.login-logo {
    width: 50px;
    height: 50px;
    background: var(--secondary);
    border-radius: 50%; /* Círculo dorado */
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-weight: bold; font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(255, 204, 0, 0.4);
}

/* Media Query para Escritorio */
@media (min-width: 900px) {
    .login-image-side { display: flex; }
}

/* Arreglo definitivo para Modales superpuestos */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-footer-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-bottom: 1px dashed transparent;
    transition: all 0.2s;
}
.login-footer-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.login-copyright {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: #9CA3AF;
    letter-spacing: 0.5px;
}

/* --- NUEVA UI ESTUDIANTE --- */

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding-bottom: 2rem;
}

.student-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.student-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 51, 204, 0.08);
}

/* Banner de imagen en la tarjeta */
.card-banner {
    height: 140px;
    background-size: cover;
    background-position: center;
    position: relative;
}
.card-banner::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.6));
}

.card-badge-status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.status-pending { color: var(--accent); }
.status-graded { color: var(--success); }

.student-card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.subject-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Botones de Acción con Iconos */
.action-area {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--bg-body);
}

.btn-upload {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.8rem;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-upload:hover { background: var(--primary-dark); }

.file-select-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}
.file-select-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0; top: 0; opacity: 0;
    cursor: pointer;
}

.grade-box {
    background: #ECFDF5;
    border: 1px solid #10B981;
    color: #065F46;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

/* --- SIDEBAR DESIGN SYSTEM (EdTech Pro) --- */

.sidebar {
    width: 280px;
    /* Fondo: Un tono más rico (Azul Noche Profundo) en vez de negro plano */
    background-color: #0f172a;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    color: #e2e8f0; /* Texto mucho más claro y legible */
    z-index: 50;
    /* Sombra suave para integrar con el contenido principal */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Header de Marca */
.brand-area {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, 0.03); /* Separación sutil */
    border-bottom: 1px solid #1e293b;
}

.brand-logo-container {
    width: 44px; height: 44px;
    background: #fff;
    border-radius: 10px; /* Bordes suaves estilo App */
    display: flex; align-items: center; justify-content: center;
    padding: 2px;
    margin-right: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.brand-logo-container img { width: 100%; height: auto; object-fit: contain; }

.brand-text { display: flex; flex-direction: column; }
.brand-title { color: #fff; font-weight: 700; font-size: 1rem; letter-spacing: 0.5px; }
.brand-subtitle { color: #94a3b8; font-size: 0.75rem; font-weight: 500; text-transform: uppercase; }

/* Navegación */
.nav-menu {
    padding: 2rem 1.2rem;
    display: flex; flex-direction: column; gap: 8px;
}

/* Botones del Menú */
.nav-btn {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 8px;
    color: #cbd5e1; /* Gris claro, alto contraste */
    background: transparent;
    border: none;
    display: flex; align-items: center; gap: 14px;
    font-weight: 500; font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer; text-align: left;
    position: relative;
    overflow: hidden;
}

.nav-btn svg {
    width: 22px; height: 22px;
    stroke-width: 1.8px;
    color: #94a3b8;
    transition: color 0.2s;
}

/* Hover Effect */
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}
.nav-btn:hover svg { color: #fff; }

/* --- ESTADO ACTIVO (El contraste que pediste) --- */
.nav-btn.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, transparent 100%); /* Gradiente azul sutil */
    color: #fff;
    font-weight: 600;
}

/* Barra lateral indicadora (Estilo Coursera/LMS modernos) */
.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0; top: 15%; height: 70%;
    width: 4px;
    background: #3b82f6; /* Azul vibrante */
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.6); /* Resplandor neón suave */
}
.nav-btn.active svg { color: #3b82f6; } /* Icono se pinta de azul */


/* --- FOOTER / LOGOUT (Estilo Imagen 2 Restaurado) --- */
.logout-area {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid #1e293b;
    background: #0b1120; /* Un tono más oscuro para anclar el footer */
}

.btn-logout-ghost {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px; /* Bordes redondeados */
    background: transparent;
    border: 1px solid #475569; /* Borde gris visible y elegante */
    color: #e2e8f0;
    font-weight: 600; font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
}

.btn-logout-ghost:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}