/* =========================================================
   SISTEMA EDUCATIVO - DISEÑO MODERNO & AMIGABLE (PLUS JAKARTA)
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary-color: #0284c7;
    --primary-dark: #0369a1;
    --primary-light: #e0f2fe;
    --secondary-color: #475569;
    --accent-color: #0ea5e9;
    --bg-color: #f8fafc;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #0284c7;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header i {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: white;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav a {
    margin: 3px 12px;
    padding: 11px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    font-weight: 600;
}

.sidebar-nav a i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    transition: transform 0.2s;
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    transform: translateX(3px);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.9), rgba(14, 165, 233, 0.9));
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.sidebar-nav a.active i {
    color: #ffffff;
}

.sidebar-nav a.logout {
    margin-top: auto;
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

.sidebar-nav a.logout:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background-color: #ffffff;
    padding: 16px 35px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: #334155;
    font-weight: 600;
}

.user-info strong {
    color: #0f172a;
}

.content-wrapper {
    padding: 30px 35px;
    flex: 1;
}

/* Card Component */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

h1, h2, h3, h4 {
    margin-top: 0;
    color: #0f172a;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
}

.btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(2, 132, 199, 0.3);
    color: white;
}

.btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-sm {
    padding: 7px 13px;
    font-size: 0.82rem;
    border-radius: 8px;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.3);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
    color: white;
}

/* Modern Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    text-align: left;
}

th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    padding: 14px 18px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 15px 18px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
    font-size: 0.9rem;
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-transform: capitalize;
    letter-spacing: 0.01em;
}

.badge-success, .MATRICULADO, .PRESENTE, .Activo, .AL_DIA, .APROBADO {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-warning, .PREINSCRITO, .TARDE, .PENDIENTE {
    background-color: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-danger, .RETIRADO, .Inactivo, .AUSENTE, .VENCIDO {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-info, .EGRESADO, .ENROLLED {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

/* Forms & Inputs */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    width: 100%;
    padding: 11px 16px;
    margin-bottom: 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-size: 0.95rem;
    color: #0f172a;
    background-color: #ffffff;
    transition: all 0.2s;
}

input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

input[type="checkbox"], input[type="radio"] {
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 6px 0 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    cursor: pointer !important;
    accent-color: var(--primary-color, #0284c7);
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 0.88rem;
    color: #334155;
}

/* Dashboard Cards Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: #ffffff;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.dashboard-card i {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: #f0f9ff;
}

.dashboard-card h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #0f172a;
}

.dashboard-card p {
    margin: 0;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.4;
}

/* Stat KPI Cards Grid */
.stat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.stat-card {
    background: #ffffff;
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.25s ease;
    text-decoration: none;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

.stat-card-info {
    display: flex;
    flex-direction: column;
}

.stat-card-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.stat-card-sub {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 4px;
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* Quick Actions Section */
.quick-actions-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    align-items: center;
}

.quick-action-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 10px 18px;
    border-radius: 12px;
    color: #1e293b;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    text-decoration: none;
}

.quick-action-btn:hover {
    background: #f8fafc;
    border-color: #0284c7;
    color: #0284c7;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.12);
}

.quick-action-btn i {
    font-size: 1rem;
}

/* Section Header */
.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #f1f5f9;
}

.dashboard-section-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-section-header span {
    font-size: 0.82rem;
    color: #64748b;
}

/* Enhanced Module Card */
.module-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

.module-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.module-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.module-card-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.module-card-title {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.module-card-desc {
    margin: 0 0 18px 0;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.45;
    flex-grow: 1;
}

.module-card-footer {
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-card-btn {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0284c7;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.2s ease;
}

.module-card:hover .module-card-btn {
    gap: 10px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-container, .modal-box {
    background: #ffffff !important;
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    width: 92%;
    max-width: 850px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid #cbd5e1;
    animation: modalSlideDown 0.22s ease-out;
    box-sizing: border-box;
    z-index: 100000;
}

.modal-container.lg, .modal-box.lg {
    max-width: 1050px;
}

.modal-container.sm, .modal-box.sm {
    max-width: 480px;
}

@keyframes modalSlideDown {
    from {
        transform: translateY(-20px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #ef4444;
    background: #fee2e2;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    color: #1e293b;
    box-sizing: border-box;
}

/* Overrides for views loaded inside modal */
.modal-body .card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

.modal-body .card-header,
.modal-body > .card > h2:first-child {
    display: none !important;
}

/* ===================================================
   CLASSROOM / LMS MODULE STYLES
   =================================================== */
.classroom-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 24px;
    background: #ffffff;
    margin-bottom: 24px;
    overflow-x: auto;
}

.classroom-nav button {
    background: none;
    border: none;
    padding: 14px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.classroom-nav button:hover {
    color: var(--primary-color, #0284c7);
    background: #f0f9ff;
}

.classroom-nav button.active {
    color: var(--primary-color, #0284c7);
    font-weight: 700;
    border-bottom: 3px solid var(--primary-color, #0284c7);
    background: transparent;
}

.classroom-tab-content {
    display: none;
    animation: fadeInTab 0.22s ease-out;
}

.classroom-tab-content.active {
    display: block;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.classroom-banner {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0f172a 100%);
    border-radius: 16px;
    padding: 30px 36px;
    color: #ffffff;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.28);
}

.classroom-banner::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
}

.classroom-banner h1 {
    margin: 0 0 6px 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.classroom-banner p {
    margin: 0;
    font-size: 0.95rem;
    color: #e0f2fe;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.classroom-announce-box {
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.classroom-announce-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.classroom-feed-item {
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.classroom-feed-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
    background: #f8fafc;
}

.activity-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    background: #ffffff;
    transition: all 0.2s ease;
}

.activity-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: left 0.3s ease;
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .content-wrapper {
        padding: 20px 15px;
    }
    .topbar {
        padding: 14px 20px;
    }
}