/* ============================================
   STUDENT RESULT MANAGEMENT SYSTEM
   Admin CSS - Modern Dark-Accented Theme
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #7c3aed;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --dark: #0f172a;
    --sidebar-bg: #0f172a;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --navbar-height: 64px;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --bg-light: #f8fafc;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --card-hover-shadow: 0 8px 32px rgba(37,99,235,.15);
    --radius: 12px;
    --font: 'Plus Jakarta Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width .3s cubic-bezier(.4,0,.2,1), transform .3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    min-height: var(--navbar-height);
    flex-shrink: 0;
}

.brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.brand-name {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    letter-spacing: .5px;
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,.4);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    padding: 16px 8px 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.65);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all .2s;
    margin-bottom: 2px;
    white-space: nowrap;
}

.sidebar-nav .nav-link i {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(37,99,235,.4), rgba(124,58,237,.3));
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.sidebar-nav .nav-link.text-danger { color: rgba(248,113,113,.7) !important; }
.sidebar-nav .nav-link.text-danger:hover { color: #f87171 !important; background: rgba(220,38,38,.1); }

/* ============================================
   MAIN WRAPPER
   ============================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
}

/* ============================================
   TOP NAVBAR
   ============================================ */
.top-navbar {
    height: var(--navbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all .2s;
}

.sidebar-toggle:hover { background: var(--bg-light); color: var(--primary); }

.navbar-breadcrumb {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.navbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 16px;
}

.admin-name { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.admin-role { display: block; font-size: 11px; color: var(--text-secondary); }

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    flex: 1;
    padding: 28px;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all .3s;
    border: 1px solid transparent;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover-shadow);
    border-color: rgba(37,99,235,.15);
}

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

.stat-icon.blue { background: #eff6ff; color: var(--primary); }
.stat-icon.purple { background: #f5f3ff; color: var(--secondary); }
.stat-icon.green { background: #ecfdf5; color: var(--success); }
.stat-icon.orange { background: #fffbeb; color: var(--warning); }
.stat-icon.red { background: #fef2f2; color: var(--danger); }
.stat-icon.cyan { background: #ecfeff; color: var(--info); }

.stat-value {
    font-size: 32px;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

/* ============================================
   CARDS
   ============================================ */
.content-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header-custom {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.card-title-custom {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body-custom { padding: 24px; }

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
    color: #fff;
}

.btn-sm-custom {
    padding: 6px 14px;
    font-size: 12px;
}

/* ============================================
   TABLES
   ============================================ */
.table-custom {
    width: 100%;
    font-size: 14px;
}

.table-custom thead th {
    background: var(--bg-light);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table-custom tbody tr:last-child td { border-bottom: none; }

.table-custom tbody tr:hover { background: var(--primary-light); }

/* ============================================
   BADGES
   ============================================ */
.badge-custom {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-secondary{ background: #f1f5f9; color: #475569; }

/* ============================================
   FORMS
   ============================================ */
.form-label-custom {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: block;
}

.form-control-custom {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    transition: all .2s;
    outline: none;
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-select-custom {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ============================================
   SCORE INPUTS
   ============================================ */
.score-input {
    width: 70px;
    text-align: center;
    padding: 8px;
}

.total-display {
    font-weight: 700;
    font-size: 16px;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--primary);
    background: var(--primary-light);
    padding: 8px 14px;
    border-radius: 8px;
    display: inline-block;
    min-width: 70px;
    text-align: center;
}

/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-zone {
    border: 2.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all .3s;
    background: #fff;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary-light), #f5f3ff);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    color: var(--primary);
    margin: 0 auto 16px;
}

/* ============================================
   STUDENT PORTAL
   ============================================ */
.student-portal-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0f172a 100%);
    min-height: 100vh;
}

.result-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.student-profile-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.student-profile-header::before {
    content: '';
    position: absolute;
    top: -50%; right: -10%;
    width: 300px; height: 300px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
}

.student-avatar-lg {
    width: 80px; height: 80px;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    border: 3px solid rgba(255,255,255,.4);
    margin-bottom: 16px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes countUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stat-value { animation: countUp .5s ease both; }

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

.content-card, .stat-card {
    animation: fadeSlideIn .4s ease both;
}

/* ============================================
   LOGIN PAGES
   ============================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,.3);
}

.login-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 36px;
    text-align: center;
    color: #fff;
}

.login-logo {
    width: 72px; height: 72px;
    background: rgba(255,255,255,.2);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
    border: 2px solid rgba(255,255,255,.3);
}

.login-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
}

.login-header p {
    font-size: 13px;
    opacity: .8;
    margin: 0;
}

.login-body { padding: 36px; }

/* ============================================
   RESPONSIVE
   ============================================ */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-link span { display: none; }
.sidebar.collapsed .brand-icon { margin: 0 auto; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }
.main-wrapper.expanded { margin-left: var(--sidebar-collapsed); }

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .page-content { padding: 16px; }
    .top-navbar { padding: 0 16px; }
    .stat-value { font-size: 24px; }
    .sidebar-overlay {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 999;
    }
}

.sidebar-overlay { display: none; }

/* DataTables override */
div.dataTables_wrapper div.dataTables_filter input {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: var(--font);
}

div.dataTables_wrapper div.dataTables_length select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: var(--font);
}

.page-link { font-family: var(--font); }

/* Alert styles */
.alert-custom {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success-custom { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error-custom   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info-custom    { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
}

/* Print styles */
@media print {
    .sidebar, .top-navbar, .no-print { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    body { background: #fff; }
}
