/* ============================================
   StudentPortal - Global CSS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --sidebar-active: #4f46e5;
    --card-bg: #fff;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.12);
    --radius: 10px;
    --sidebar-width: 250px;
    --topbar-height: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.auth-wrapper { width: 100%; display: flex; justify-content: center; }
.auth-card {
    background: white; border-radius: 16px; padding: 2.5rem;
    width: 100%; max-width: 440px; box-shadow: var(--shadow-lg);
    animation: slideUp .4s ease;
}
.auth-card-wide { max-width: 620px; }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo i { font-size: 2.5rem; color: var(--primary); }
.auth-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); margin: .5rem 0 .25rem; }
.auth-logo p { color: var(--text-muted); font-size: .875rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); font-size: .875rem; }
.auth-demo-hint { text-align: center; margin-top: 1rem; background: var(--primary-light); border-radius: 6px; padding: .5rem; font-size: .8rem; }
.register-note { background: #fef3c7; border: 1px solid #fcd34d; border-radius: 8px; padding: .75rem 1rem; font-size: .85rem; color: #92400e; margin-bottom: 1rem; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0;
    background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; z-index: 100;
    transition: transform .3s ease;
    overflow-y: auto;
}
.sidebar.collapsed { transform: translateX(-100%); }
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 1.25rem 1.5rem; font-size: 1.1rem; font-weight: 700;
    color: white; border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand i { color: #818cf8; font-size: 1.3rem; }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-section-label {
    font-size: .7rem; font-weight: 600; letter-spacing: .08em;
    color: rgba(255,255,255,.4); text-transform: uppercase;
    padding: 1rem 1.5rem .25rem;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: .65rem 1.5rem; color: var(--sidebar-text);
    font-size: .875rem; cursor: pointer; transition: all .2s;
    border-radius: 0;
    text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: white; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: white; font-weight: 600; }
.nav-item i { width: 18px; text-align: center; opacity: .85; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding: .75rem 0; }
.logout-btn:hover { background: rgba(239,68,68,.2) !important; color: #fca5a5 !important; }

/* ============================================
   MAIN CONTENT & TOPBAR
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh; transition: margin-left .3s ease;
}
.main-content.expanded { margin-left: 0; }
.topbar {
    height: var(--topbar-height); background: white;
    display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow);
}
.topbar-title { flex: 1; font-size: 1rem; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: var(--text-muted); padding: .25rem .5rem;
    border-radius: 6px; transition: background .2s;
}
.sidebar-toggle:hover { background: var(--bg); }
.badge-admin { background: var(--primary-light); color: var(--primary); padding: .25rem .75rem; border-radius: 50px; font-size: .75rem; font-weight: 600; }
.badge-user { background: #d1fae5; color: #065f46; padding: .25rem .75rem; border-radius: 50px; font-size: .75rem; font-weight: 600; }
.user-name { font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.page-content { padding: 1.5rem; }

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    overflow: hidden;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); background: #fafafa;
}
.card-header h3 { font-size: .95rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 1.25rem; }
.form-card { max-width: 800px; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card {
    border-radius: var(--radius); padding: 1.25rem; display: flex;
    align-items: center; gap: 1rem; box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-blue { background: linear-gradient(135deg, #4f46e5, #4338ca); color: white; }
.stat-green { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.stat-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; }
.stat-orange { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.stat-icon { font-size: 2rem; opacity: .85; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; opacity: .85; margin-top: .25rem; }

/* ============================================
   TABLES
   ============================================ */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th {
    text-align: left; padding: .75rem 1rem; background: #f8fafc;
    font-weight: 600; font-size: .75rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.data-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-count { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; }

/* ============================================
   BADGES
   ============================================ */
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 50px; font-size: .73rem; font-weight: 600; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-active { background: #d1fae5; color: #065f46; }
.count-badge { background: var(--primary); color: white; padding: .2rem .65rem; border-radius: 50px; font-size: .8rem; font-weight: 600; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: .5rem 1rem; border-radius: 8px; font-size: .875rem;
    font-weight: 500; cursor: pointer; border: 1px solid transparent;
    transition: all .2s; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { filter: brightness(1.1); }
.btn-secondary { background: #64748b; color: white; }
.btn-outline { background: white; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: .5rem; align-items: center; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; color: var(--text); margin-bottom: .4rem; }
.form-control {
    width: 100%; padding: .55rem .85rem; border: 1px solid var(--border);
    border-radius: 8px; font-size: .875rem; font-family: inherit;
    transition: border-color .2s, box-shadow .2s; background: white; color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-control-lg { padding: .75rem 1rem; font-size: 1rem; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.form-check-row { margin-bottom: 1rem; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .875rem; }
.checkbox-label input { width: 16px; height: 16px; cursor: pointer; }
.text-danger { font-size: .8rem; color: var(--danger); display: block; margin-top: .25rem; }
.toggle-wrapper { display: flex; align-items: center; gap: 8px; padding-top: .5rem; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: .75rem 1rem; border-radius: 8px; font-size: .875rem;
    display: flex; align-items: center; gap: 8px; margin-bottom: 1rem;
    transition: opacity .5s;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* ============================================
   PAGE ACTIONS BAR
   ============================================ */
.page-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.search-bar { display: flex; gap: .5rem; flex: 1; max-width: 400px; }
.filter-form { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1; }

/* ============================================
   FILTER TABS
   ============================================ */
.filter-tabs { display: flex; gap: .25rem; }
.tab {
    padding: .4rem 1rem; border-radius: 6px; font-size: .85rem; font-weight: 500;
    color: var(--text-muted); background: white; border: 1px solid var(--border);
    text-decoration: none; transition: all .2s; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.tab-count { background: rgba(255,255,255,.3); border-radius: 50px; padding: 0 6px; font-size: .7rem; }
.tab-pending.active { background: #f59e0b; border-color: #f59e0b; }
.tab-approved.active { background: #10b981; border-color: #10b981; }
.tab-rejected.active { background: #ef4444; border-color: #ef4444; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: .4; display: block; }
.empty-state p { font-size: .95rem; }

/* ============================================
   ACTION BUTTONS COLUMN
   ============================================ */
.action-btns { display: flex; gap: .4rem; flex-wrap: wrap; }
.link-count { font-size: .8rem; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; }

/* ============================================
   IMPORT PAGE
   ============================================ */
.import-instructions {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
    padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.import-instructions h4 { font-size: .9rem; font-weight: 600; margin-bottom: .5rem; color: #1d4ed8; }
.import-instructions ol { padding-left: 1.25rem; font-size: .85rem; color: #1e40af; }
.import-instructions li { margin-bottom: .25rem; }
.file-upload-area {
    border: 2px dashed var(--border); border-radius: 8px; padding: 2rem;
    text-align: center; cursor: pointer; transition: all .2s;
    background: #fafafa;
}
.file-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.file-upload-area i { font-size: 2.5rem; color: var(--primary); margin-bottom: .5rem; display: block; }
.file-upload-area p { font-weight: 500; color: var(--text); }
.file-upload-area small { color: var(--text-muted); }
.file-name-display { margin-top: .5rem; font-size: .85rem; color: var(--primary); font-weight: 500; }

/* ============================================
   PROCESS REQUEST PAGE
   ============================================ */
.request-info-banner {
    display: flex; gap: 1.5rem; background: white; border-radius: var(--radius);
    border: 1px solid var(--border); padding: 1rem 1.25rem; margin-bottom: 1rem;
    flex-wrap: wrap; box-shadow: var(--shadow);
}
.ri-item { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--text); }
.ri-item i { color: var(--primary); }
.selection-controls { display: flex; align-items: center; gap: .75rem; }
.selection-count { font-size: .85rem; font-weight: 600; color: var(--primary); background: var(--primary-light); padding: .2rem .75rem; border-radius: 50px; }
.student-search-bar { margin-bottom: 1rem; }
.student-select-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .75rem; max-height: 60vh; overflow-y: auto; padding-right: 4px;
}
.student-card-select {
    display: flex; align-items: flex-start; gap: 10px;
    border: 2px solid var(--border); border-radius: 10px; padding: .75rem;
    cursor: pointer; transition: all .2s; background: white; position: relative;
}
.student-card-select:hover { border-color: var(--primary); background: var(--primary-light); }
.student-card-select input { display: none; }
.student-card-select input:checked ~ .sc-info .sc-name,
.student-card-select:has(input:checked) { border-color: var(--primary); background: #e0e7ff; }
.student-card-select:has(input:checked) { border-color: var(--primary); background: #e0e7ff; }
.student-card-select:has(input:checked) .sc-check { visibility: visible; opacity: 1; }
.sc-check { position: absolute; right: 8px; top: 8px; color: var(--primary); visibility: hidden; opacity: 0; transition: opacity .2s; }
.sc-info { flex: 1; }
.sc-name { font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .25rem; }
.sc-details { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .75rem; color: var(--text-muted); }
.sc-details span { display: inline-flex; align-items: center; gap: 3px; }
.sc-roll { font-size: .73rem; color: var(--text-muted); margin-top: .25rem; }

/* ============================================
   USER PANEL - QUICK ACTIONS
   ============================================ */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.quick-action-btn {
    background: white; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; display: flex; flex-direction: column; align-items: center;
    text-align: center; gap: .5rem; text-decoration: none; transition: all .2s;
    box-shadow: var(--shadow); color: var(--text);
}
.quick-action-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); text-decoration: none; color: var(--primary); }
.quick-action-btn i { font-size: 2rem; color: var(--primary); }
.quick-action-btn span { font-weight: 600; font-size: .95rem; }
.quick-action-btn small { color: var(--text-muted); font-size: .8rem; }

/* ============================================
   INFO BOX
   ============================================ */
.info-box {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
    padding: 1rem 1.25rem; margin-bottom: 1.5rem;
    display: flex; gap: 1rem; align-items: flex-start;
}
.info-box > i { color: var(--info); font-size: 1.1rem; margin-top: 2px; flex-shrink: 0; }
.info-box strong { font-weight: 600; color: #1d4ed8; }
.info-box ul { margin: .4rem 0 0 1rem; font-size: .85rem; color: #1e40af; }
.info-box li { margin-bottom: .2rem; }

/* ============================================
   Misc
   ============================================ */
.d-block { display: block; }
.text-muted { color: var(--text-muted); font-size: .8rem; }
small.d-block { margin-top: 2px; }