/* ===================================================
   Academic Management System (AMS) - Custom Styles
   Designed for College of Information Technology
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

:root {
    --primary:    #2563eb;
    --primary-dk: #1d4ed8;
    --success:    #16a34a;
    --warning:    #d97706;
    --danger:     #dc2626;
    --info:       #0891b2;
    --dark:       #1e293b;
    --sidebar-bg: #0f172a;
    --sidebar-w:  260px;
    --card-radius: 14px;
    --shadow:     0 4px 20px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Cairo', sans-serif;
    background: #f1f5f9;
    color: #334155;
    direction: rtl;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.sidebar-brand h5 {
    color: #f8fafc;
    font-weight: 800;
    font-size: 1rem;
    margin: 0;
    line-height: 1.4;
}

.sidebar-brand small {
    color: #94a3b8;
    font-size: 0.78rem;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.4rem;
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav .nav-label {
    padding: 16px 20px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 1px;
    font-weight: 700;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border-right-color: #475569;
}

.sidebar-nav a.active {
    background: rgba(37,99,235,0.15);
    color: #60a5fa;
    border-right-color: var(--primary);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ---- MAIN CONTENT ---- */
.main-wrapper {
    margin-right: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    background: #ffffff;
    padding: 14px 28px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

.top-header .page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.top-header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.page-content {
    flex: 1;
    padding: 28px;
}

/* ---- STAT CARDS ---- */
.stat-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #f1f5f9;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

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

.stat-icon.blue   { background: #eff6ff; color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.yellow { background: #fffbeb; color: var(--warning); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-icon.cyan   { background: #ecfeff; color: var(--info); }
.stat-icon.purple { background: #faf5ff; color: #7c3aed; }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.ams-card .card-head {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ams-card .card-head h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
}

.ams-card .card-body-p {
    padding: 24px;
}

/* ---- TABLES ---- */
.ams-table {
    width: 100%;
    border-collapse: collapse;
}

.ams-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.ams-table thead th {
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    text-align: right;
}

.ams-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.9rem;
}

.ams-table tbody tr:hover {
    background: #f8fafc;
}

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

/* ---- BADGES ---- */
.badge-role {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ---- BUTTONS ---- */
.btn-ams {
    padding: 9px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-ams:hover { transform: translateY(-1px); }
.btn-ams.primary { background: var(--primary); color: white; }
.btn-ams.primary:hover { background: var(--primary-dk); color: white; }
.btn-ams.success { background: var(--success); color: white; }
.btn-ams.danger  { background: var(--danger); color: white; }
.btn-ams.secondary { background: #e2e8f0; color: #475569; }

/* ---- GPA BADGE ---- */
.gpa-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 800;
    color: white;
}

.gpa-4 { background: linear-gradient(135deg, #16a34a, #15803d); }
.gpa-3 { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.gpa-2 { background: linear-gradient(135deg, #d97706, #b45309); }
.gpa-1 { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.gpa-0 { background: #94a3b8; }

/* ---- FORMS ---- */
.form-control, .form-select {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 10px 14px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

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

/* ---- ALERTS ---- */
.alert { border-radius: 12px; border: none; padding: 14px 18px; font-weight: 600; }

/* ---- BREADCRUMB ---- */
.breadcrumb-ams {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 20px;
}

.breadcrumb-ams .current { color: var(--dark); font-weight: 700; }

/* ---- CHART CONTAINER ---- */
.chart-wrap {
    position: relative;
    height: 280px;
}

/* ---- RESPONSIVE / MOBILE ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #475569;
    cursor: pointer;
    padding: 4px 8px;
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(110%);
        z-index: 1050;
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-right: 0; }
    .mobile-menu-btn { display: inline-flex; align-items: center; }
    .page-content { padding: 16px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.5rem; }
}

@media (max-width: 576px) {
    .login-card { width: 95vw; padding: 28px 20px; }
    .page-content { padding: 12px; }
    .top-header { padding: 10px 14px; }
    .ams-card .card-body-p { padding: 14px; }
    .btn-ams { padding: 8px 14px; font-size: 0.82rem; }
}

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 420px;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.login-logo-wrap {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
}

/* ---- PRINT ---- */
@media print {
    .sidebar, .top-header, .no-print { display: none !important; }
    .main-wrapper { margin-right: 0; }
    .page-content { padding: 0; }
}

/* ---- DARK MODE OVERRIDES ---- */
[data-bs-theme="dark"] body {
    background: #111827 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3, 
[data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6,
[data-bs-theme="dark"] p, [data-bs-theme="dark"] .text-muted {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .top-header {
    background: #1e293b !important;
    border-bottom-color: #334155 !important;
}

[data-bs-theme="dark"] .top-header .page-title,
[data-bs-theme="dark"] .stat-value,
[data-bs-theme="dark"] .ams-card .card-head h5 {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .ams-card,
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .ams-table thead tr {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
}

[data-bs-theme="dark"] .ams-table tbody td {
    border-bottom-color: #334155 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .ams-table tbody tr:hover {
    background: #334155 !important;
}

[data-bs-theme="dark"] .form-control, 
[data-bs-theme="dark"] .form-select {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .breadcrumb-ams .current {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .modal-header, 
[data-bs-theme="dark"] .modal-footer {
    border-color: #334155 !important;
    background-color: #0f172a !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #0f172a !important;
}

[data-bs-theme="dark"] .list-group-item {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .list-group-item:hover {
    background-color: #334155 !important;
}

[data-bs-theme="dark"] body {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .page-content {
    background: #0f172a !important;
}

[data-bs-theme="dark"] .main-wrapper {
    background: #0f172a !important;
}

[data-bs-theme="dark"] .card-header {
    background: #1e293b !important;
    border-bottom-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .card-body {
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .table {
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .table thead th {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .table tbody td {
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255,255,255,0.03) !important;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: #334155 !important;
}

[data-bs-theme="dark"] .alert-info {
    background: rgba(8,145,178,0.15) !important;
    border-color: rgba(8,145,178,0.3) !important;
    color: #7dd3fc !important;
}

[data-bs-theme="dark"] .alert-success {
    background: rgba(22,163,74,0.15) !important;
    border-color: rgba(22,163,74,0.3) !important;
    color: #86efac !important;
}

[data-bs-theme="dark"] .alert-warning {
    background: rgba(217,119,6,0.15) !important;
    border-color: rgba(217,119,6,0.3) !important;
    color: #fcd34d !important;
}

[data-bs-theme="dark"] .alert-danger {
    background: rgba(220,38,38,0.15) !important;
    border-color: rgba(220,38,38,0.3) !important;
    color: #fca5a5 !important;
}

[data-bs-theme="dark"] .alert-secondary {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .badge.bg-light {
    background: #334155 !important;
    color: #e2e8f0 !important;
}

.bg-purple {
    background-color: #6f42c1 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .badge.bg-purple {
    background: rgba(111, 66, 193, 0.25) !important;
    color: #d8b4fe !important;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top {
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .progress {
    background: #334155 !important;
}

[data-bs-theme="dark"] select option {
    background: #1e293b;
    color: #f1f5f9;
}

[data-bs-theme="dark"] .input-group-text {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #94a3b8 !important;
    border-color: #475569 !important;
}

[data-bs-theme="dark"] .btn-light {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background: #334155 !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background: #1e293b !important;
    border-color: #334155 #334155 #1e293b !important;
    color: #60a5fa !important;
}

[data-bs-theme="dark"] .pagination .page-link {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #60a5fa !important;
}

[data-bs-theme="dark"] .pagination .page-item.active .page-link {
    background: var(--primary) !important;
}

/* Theme Toggle Button styles */
#themeToggleBtn {
    transition: all 0.2s ease;
}
[data-bs-theme="dark"] #themeToggleBtn {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-bs-theme="dark"] #themeToggleBtn:hover {
    background: #334155 !important;
}
