/* ============================================================
   main.css — Course Management Portal Design System
   Bootstrap 5.3 base + custom layer
   ============================================================ */

/* ── CSS Custom Properties ──────────────────────────────── */
:root {
    /* Brand palette */
    --primary:        #667eea;
    --primary-dark:   #5a6fd6;
    --primary-light:  #e8eaff;

    --admin-start:    #1a1a2e;
    --admin-end:      #16213e;
    --admin-accent:   #e94560;

    --student-start:  #667eea;
    --student-end:    #764ba2;

    /* Neutrals */
    --bg-page:        #f0f2f5;
    --bg-card:        #ffffff;
    --text-muted:     #6c757d;
    --border-light:   #e9ecef;

    /* Feedback */
    --success:        #28a745;
    --danger:         #dc3545;
    --warning:        #ffc107;
    --info:           #17a2b8;

    /* Shadows */
    --shadow-sm:      0 1px 4px rgba(0,0,0,.08);
    --shadow-md:      0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:      0 8px 32px rgba(0,0,0,.13);

    /* Radius */
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      16px;

    /* Navbar height */
    --navbar-h:       64px;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--bg-page);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #212529;
    min-height: 100vh;
}

/* ── Auth Pages (login / register) ─────────────────────── */
body.auth-page {
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem 2.25rem;
    width: 100%;
    max-width: 460px;
}

.auth-logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: -.5px;
}

.auth-logo span { opacity: .85; font-size: 1rem; font-weight: 400; }

/* ── ADMIN Navbar ───────────────────────────────────────── */
.navbar-admin {
    background: linear-gradient(135deg, var(--admin-start), var(--admin-end));
    height: var(--navbar-h);
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-admin .navbar-brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.3px; }

.navbar-admin .nav-link {
    color: rgba(255,255,255,.75) !important;
    font-size: .875rem;
    padding: .5rem .85rem !important;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.navbar-admin .nav-link:hover,
.navbar-admin .nav-link.active {
    background: rgba(255,255,255,.12);
    color: #fff !important;
}

/* ── STUDENT Navbar ─────────────────────────────────────── */
.navbar-student {
    background: linear-gradient(135deg, var(--student-start), var(--student-end));
    height: var(--navbar-h);
    box-shadow: 0 2px 12px rgba(102,126,234,.4);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-student .navbar-brand { font-weight: 700; font-size: 1.15rem; }

.navbar-student .nav-link {
    color: rgba(255,255,255,.8) !important;
    font-size: .875rem;
    padding: .5rem .85rem !important;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.navbar-student .nav-link:hover,
.navbar-student .nav-link.active {
    background: rgba(255,255,255,.15);
    color: #fff !important;
}

/* User badge in navbar */
.navbar-user-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: rgba(255,255,255,.9);
    font-size: .875rem;
}

.navbar-user-badge .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
}

/* ── Page Wrapper ───────────────────────────────────────── */
.page-wrapper {
    padding: 1.75rem 0 3rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.page-subtitle {
    font-size: .875rem;
    color: var(--text-muted);
    margin: .15rem 0 0;
}

/* ── Stat Cards (Dashboard) ─────────────────────────────── */
.stat-card {
    border: none;
    border-radius: var(--radius-md);
    padding: 1.4rem 1.6rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px; bottom: -20px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
}

.stat-card .stat-icon { font-size: 2.2rem; margin-bottom: .6rem; }
.stat-card .stat-value { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .85rem; opacity: .85; margin-top: .3rem; }

.stat-blue   { background: linear-gradient(135deg, #4e73df, #224abe); }
.stat-green  { background: linear-gradient(135deg, #1cc88a, #13855c); }
.stat-orange { background: linear-gradient(135deg, #f6c23e, #dda20a); }
.stat-red    { background: linear-gradient(135deg, #e74a3b, #be2617); }
.stat-purple { background: linear-gradient(135deg, #764ba2, #5a3576); }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}

.card-header-custom {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

/* ── Tables ─────────────────────────────────────────────── */
.table-card {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive { border-radius: var(--radius-md); }

.table {
    margin-bottom: 0;
    font-size: .875rem;
}

.table thead th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--border-light);
    padding: .85rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: .8rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: #495057;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8f9fe; }

/* ── Badges ─────────────────────────────────────────────── */
.badge-category {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: .75rem;
    font-weight: 600;
    padding: .3em .75em;
    border-radius: 20px;
}

.badge-dept {
    background: #e8f5e9;
    color: #2e7d32;
    font-size: .75rem;
    font-weight: 600;
    padding: .3em .75em;
    border-radius: 20px;
}

/* ── Action Buttons in Table ────────────────────────────── */
.btn-action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 6px;
    border: none;
    font-size: .85rem;
    transition: opacity .15s, transform .1s;
    text-decoration: none;
}
.btn-action:hover { opacity: .85; transform: scale(1.08); }
.btn-action.view   { background: #e3f2fd; color: #1565c0; }
.btn-action.edit   { background: #fff3e0; color: #e65100; }
.btn-action.delete { background: #fce4ec; color: #c62828; }
.btn-action.enroll { background: #e8f5e9; color: #2e7d32; }

/* ── Search / Filter Bar ────────────────────────────────── */
.filter-bar {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
}

.filter-bar .form-control,
.filter-bar .form-select {
    font-size: .875rem;
    border-radius: var(--radius-sm);
    border-color: #dee2e6;
}

.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
    margin: 0;
    gap: 4px;
}

.page-link {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-light);
    color: var(--primary);
    font-size: .85rem;
    padding: .4rem .75rem;
    transition: background .15s, color .15s;
}
.page-link:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled .page-link { color: #adb5bd; }

/* ── Buttons (primary override) ─────────────────────────── */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

/* ── Form Styles ────────────────────────────────────────── */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 2rem;
}

.form-label { font-weight: 600; font-size: .875rem; color: #495057; }

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: #dee2e6;
    font-size: .9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

/* ── Welcome Banner (student) ───────────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, var(--student-start), var(--student-end));
    color: #fff;
    border-radius: var(--radius-md);
    padding: 1.6rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}
.welcome-banner h4 { font-weight: 700; margin-bottom: .35rem; }
.welcome-banner p  { opacity: .85; margin: 0; font-size: .9rem; }

/* ── Quick-Action Cards (dashboard) ─────────────────────── */
.quick-action-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    text-align: center;
    transition: transform .2s, box-shadow .2s;
    height: 100%;
}
.quick-action-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.quick-action-card .qac-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.quick-action-card h5 { font-weight: 700; font-size: 1rem; }
.quick-action-card p  { color: var(--text-muted); font-size: .85rem; }

/* ── Course Detail ──────────────────────────────────────── */
.course-detail-header {
    background: linear-gradient(135deg, var(--admin-start), var(--admin-end));
    color: #fff;
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.detail-meta span {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .875rem; color: rgba(255,255,255,.8);
    margin-right: 1.25rem;
}

/* ── Toast Alerts ───────────────────────────────────────── */
.toast-container { z-index: 1080; }

.toast-custom {
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: .875rem;
    min-width: 280px;
}
.toast-custom.toast-success { background: #d4edda; color: #155724; }
.toast-custom.toast-danger  { background: #f8d7da; color: #721c24; }
.toast-custom.toast-info    { background: #d1ecf1; color: #0c5460; }

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .45; }
.empty-state p { font-size: .95rem; margin: 0; }

/* ── Enrollment Status Badge ────────────────────────────── */
.enrolled-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    background: #e8f5e9; color: #2e7d32;
    border-radius: 20px; padding: .25em .75em;
    font-size: .78rem; font-weight: 600;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 991px) {

    /* Navbar height becomes auto when toggler is used */
    .navbar-admin,
    .navbar-student {
        height: auto;
        min-height: var(--navbar-h);
        padding: 0 1rem;
    }

    /* Expanded dropdown gets same gradient background */
    .navbar-admin .navbar-collapse,
    .navbar-student .navbar-collapse {
        padding: .75rem 0 1rem;
        border-top: 1px solid rgba(255,255,255,.12);
        margin-top: .5rem;
    }

    /* Nav links become full-width blocks */
    .navbar-admin .nav-link,
    .navbar-student .nav-link {
        padding: .6rem 1rem !important;
        border-radius: var(--radius-sm);
        display: block;
    }

    /* User badge stacks neatly */
    .navbar-user-badge {
        padding: .5rem 1rem;
        border-top: 1px solid rgba(255,255,255,.1);
        margin-top: .5rem;
    }

    /* Logout button full width */
    .navbar-admin .btn,
    .navbar-student .btn {
        width: 100%;
        margin-top: .5rem;
    }

    /* Remove gap between nav items on mobile */
    .navbar-nav.gap-1 { gap: 0 !important; }
}

@media (max-width: 768px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .filter-bar  { flex-direction: column; }
    .filter-bar > * { width: 100%; }
    .form-card { padding: 1.25rem; }
    .auth-card { padding: 1.5rem 1.25rem; }
}
