/* ===== VARIABLES ===== */
:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --primary-dark: #0d1257;
    --accent: #ff6f00;
    --accent-light: #ff8f00;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --bg: #f0f2f8;
    --card-bg: #ffffff;
    --text: #1e2a3a;
    --text-muted: #6b7a99;
    --border: #e2e8f0;
    --success: #00897b;
    --danger: #e53935;
    --warning: #f57c00;
    --info: #0288d1;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(26,35,126,0.08);
    --shadow-lg: 0 8px 32px rgba(26,35,126,0.12);
    --font: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    overflow-x: hidden;
}

/* ===== LAYOUT ===== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 20px 24px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

    .sidebar-brand i {
        font-size: 22px;
        color: var(--accent-light);
    }

.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.user-info {
    min-width: 0;
}

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: rgba(255,255,255,0.55);
    font-size: 11px;
    margin-top: 2px;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

    .sidebar-menu li a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 24px;
        color: rgba(255,255,255,0.7);
        text-decoration: none;
        font-size: 13.5px;
        font-weight: 500;
        transition: all 0.2s;
        border-left: 3px solid transparent;
    }

        .sidebar-menu li a:hover {
            color: #fff;
            background: rgba(255,255,255,0.08);
            border-left-color: rgba(255,255,255,0.3);
        }

    .sidebar-menu li.active a {
        color: #fff;
        background: rgba(255,255,255,0.12);
        border-left-color: var(--accent-light);
    }

    .sidebar-menu li a i {
        font-size: 17px;
        width: 20px;
        text-align: center;
        flex-shrink: 0;
    }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.logout-btn {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.6) !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

    .logout-btn:hover {
        color: #fff !important;
    }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

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

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.topbar-right {
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== CONTENT AREA ===== */
.content-area {
    padding: 24px;
    flex: 1;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .card-header h5 {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
    }

    .card-header i {
        color: var(--primary);
        font-size: 18px;
    }

.card-body {
    padding: 20px;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

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

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

    .stat-icon.blue {
        background: #e8eaf6;
        color: var(--primary);
    }

    .stat-icon.green {
        background: #e0f2f1;
        color: var(--success);
    }

    .stat-icon.orange {
        background: #fff3e0;
        color: var(--warning);
    }

    .stat-icon.red {
        background: #ffebee;
        color: var(--danger);
    }

.stat-info {
    min-width: 0;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

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

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

.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid var(--border);
    padding: 9px 12px;
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
        outline: none;
    }

    .form-control[readonly] {
        background: #f8f9fd;
        color: var(--text-muted);
    }

/* ===== BUTTONS ===== */
.btn {
    border-radius: 8px;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13.5px;
    padding: 9px 20px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--primary-light);
        color: #fff;
    }

.btn-success {
    background: var(--success);
    color: #fff;
}

    .btn-success:hover {
        background: #00796b;
        color: #fff;
    }

.btn-danger {
    background: var(--danger);
    color: #fff;
}

    .btn-danger:hover {
        background: #c62828;
        color: #fff;
    }

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

    .btn-outline-primary:hover {
        background: var(--primary);
        color: #fff;
    }

.btn-secondary {
    background: #e9ecef;
    color: var(--text);
}

/* ===== TABLE ===== */
.table {
    font-size: 13.5px;
}

    .table th {
        background: #f8f9fd;
        color: var(--text-muted);
        font-weight: 600;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-color: var(--border);
        padding: 10px 14px;
    }

    .table td {
        padding: 12px 14px;
        vertical-align: middle;
        border-color: var(--border);
        color: var(--text);
    }

    .table tbody tr:hover {
        background: #f8f9fd;
    }

/* ===== BADGES ===== */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    font-family: var(--font);
}

.badge-active {
    background: #e0f2f1;
    color: #00695c;
}

.badge-inactive {
    background: #ffebee;
    color: #c62828;
}

.badge-pass {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-fail {
    background: #ffebee;
    color: #c62828;
}

.badge-pending {
    background: #fff8e1;
    color: #e65100;
}

.badge-verified {
    background: #e3f2fd;
    color: #0277bd;
}

/* ===== ALERTS ===== */
.alert {
    border-radius: 8px;
    font-size: 13.5px;
    border: none;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 24px;
}

    .page-header h4 {
        font-size: 20px;
        font-weight: 700;
        color: var(--text);
        margin-bottom: 4px;
    }

    .page-header p {
        color: var(--text-muted);
        font-size: 13px;
        margin: 0;
    }

/* ===== STUDENT DETAIL BOX ===== */
.student-detail-box {
    background: #f0f4ff;
    border: 1.5px solid #c5cae9;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 12px;
}

    .student-detail-box .detail-row {
        display: flex;
        gap: 8px;
        margin-bottom: 8px;
        font-size: 13.5px;
    }

    .student-detail-box .detail-label {
        color: var(--text-muted);
        font-weight: 600;
        min-width: 120px;
        flex-shrink: 0;
    }

    .student-detail-box .detail-value {
        color: var(--text);
        font-weight: 500;
    }

/* ===== FILE UPLOAD ===== */
.file-upload-wrapper {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8f9fd;
    transition: border-color 0.2s;
}

    .file-upload-wrapper:hover {
        border-color: var(--primary);
    }

    .file-upload-wrapper i {
        font-size: 28px;
        color: var(--text-muted);
        margin-bottom: 6px;
    }

    .file-upload-wrapper p {
        font-size: 12px;
        color: var(--text-muted);
        margin: 0;
    }

/* ===== DIVIDER ===== */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }

        .sidebar-overlay.show {
            display: block;
        }
}

@media (max-width: 576px) {
    .content-area {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .stat-value {
        font-size: 22px;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f0f2f8;
}

::-webkit-scrollbar-thumb {
    background: #c5cae9;
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-light);
    }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

    .login-logo i {
        font-size: 48px;
        color: var(--primary);
    }

    .login-logo h2 {
        font-size: 22px;
        font-weight: 700;
        color: var(--text);
        margin-top: 8px;
    }

    .login-logo p {
        font-size: 13px;
        color: var(--text-muted);
        margin: 0;
    }

/* ===== UTILITIES ===== */
.text-primary-custom {
    color: var(--primary) !important;
}

.bg-primary-soft {
    background: #e8eaf6;
}

.fw-600 {
    font-weight: 600;
}

.gap-8 {
    gap: 8px;
}

.mt-20 {
    margin-top: 20px;
}

.prn-display {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    background: #e8eaf6;
    padding: 8px 16px;
    border-radius: 8px;
    letter-spacing: 2px;
    display: inline-block;
}

.sidebar-institute {
    padding: 0 24px 12px 24px;
    color: rgba(255,255,255,0.45);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 4px;
}

/* ===== MOBILE RESPONSIVE FIXES ===== */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .main-content {
        margin-left: 0 !important;
    }
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .topbar-title {
        font-size: 12px !important;
    }
    .content-area {
        padding: 12px !important;
    }
}

/* Stat cards full width on small mobile */
@media (max-width: 480px) {
    .stat-card {
        padding: 14px;
    }
    .stat-value {
        font-size: 20px;
    }
    .col-6 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .table {
        font-size: 12px;
    }
    .table th, .table td {
        padding: 8px 8px !important;
    }
    .btn-sm {
        font-size: 11px;
        padding: 5px 8px;
    }
    .card-header h5 {
        font-size: 13px;
    }
}

/* Dashboard stat cards responsive */
@media (max-width: 768px) {
    .page-header h4 {
        font-size: 16px;
    }
    .page-header p {
        font-size: 12px;
    }
    .student-detail-box .detail-row {
        flex-direction: column;
        gap: 2px;
    }
    .student-detail-box .detail-label {
        min-width: unset;
        font-size: 11px;
    }
    .modal-dialog {
        margin: 10px;
    }
}
