/* IBM Plex Sans Arabic Fonts */
@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #0f3460;
    --primary-gradient: linear-gradient(135deg, #0b1e36 0%, #162447 50%, #1f4068 100%);
    --primary-accent: #0284c7;
    --secondary: #10b981;
    --secondary-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --bg-page: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #ef4444;
    --font-family: 'IBMPlexSansArabic', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.portal-header {
    background: transparent;
    color: #0b1e36;
    padding: 0.65rem 0;
    position: relative;
    border-bottom: 1px solid #cbd5e1;
}

.portal-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #0b1e36 0%, #0284c7 55%, #10b981 100%);
}

.portal-header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.brand-logo:hover {
    transform: scale(1.02);
}

.brand-logo img {
    height: 54px;
    width: auto;
    display: block;
    object-fit: contain;
}

.brand-divider {
    width: 1.5px;
    height: 36px;
    background: linear-gradient(to bottom, transparent, #94a3b8, transparent);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #0b1e36;
    line-height: 1.25;
}

.brand-text p {
    font-size: 0.85rem;
    color: #0f3460;
    font-weight: 600;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.academic-year-pill {
    background: rgba(15, 52, 96, 0.08);
    border: 1px solid rgba(15, 52, 96, 0.2);
    color: #0b1e36;
    padding: 1px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-badge {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #cbd5e1;
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0b1e36;
}

@media (max-width: 640px) {
    .brand-divider {
        display: none;
    }
    .brand-logo img {
        height: 42px;
    }
    .brand-text h1 {
        font-size: 1.1rem;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--primary-accent);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}
.btn-primary:hover {
    background: #0274b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.35);
}

.btn-success {
    background: var(--secondary-gradient);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.35);
}

.btn-outline-light {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f3460;
}
.btn-outline-light:hover {
    background: #f0f9ff;
    border-color: #0284c7;
    color: #0284c7;
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.btn-secondary:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

/* Login Card */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
    padding: 12px 15px 30px;
}

.login-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--card-border);
    padding: 36px;
}

.login-card-header {
    text-align: center;
    margin-bottom: 26px;
}

.login-card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.login-card-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 11px 15px;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-block {
    width: 100%;
}

/* Alert Boxes */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.5;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fee2e2;
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fef3c7;
}

.alert-info {
    background-color: #f0f9ff;
    color: #0369a1;
    border: 1px solid #e0f2fe;
}

/* Student Profile Bar */
.student-profile-bar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 20px 26px;
    margin-bottom: 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    box-shadow: var(--shadow-sm);
}

.student-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(2, 132, 199, 0.2);
}

.student-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.student-info p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* Course Cards & Accordion */
.course-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.course-card:hover {
    box-shadow: var(--shadow-md);
}

.course-card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    padding: 15px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    text-align: right;
    font-family: inherit;
}

.accordion-toggle {
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.accordion-toggle:hover {
    background: #f1f5f9;
}

.course-accordion:not(.is-open) .course-card-header {
    border-bottom: none;
}

.accordion-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.accordion-chevron {
    font-size: 0.8rem;
    color: #475569;
    transition: transform 0.25s ease;
    display: inline-block;
}

.course-accordion.is-open .accordion-chevron {
    transform: rotate(180deg);
}

.course-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.course-code-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.course-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.course-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
}

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

/* Tables */
.section-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 14px;
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    text-align: right;
}

.table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 12px 18px;
    border-bottom: 1.5px solid var(--card-border);
    white-space: nowrap;
}

.table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    vertical-align: middle;
}

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

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

/* Badges & Scores */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.badge-success {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #64748b;
}

.badge-primary {
    background-color: #e0f2fe;
    color: #0369a1;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.text-muted {
    color: var(--text-muted);
}

.grade-box {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0284c7;
}

/* Answered Exam Model Cards */
.exam-questions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.exam-question-card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background: #ffffff;
    overflow: hidden;
    page-break-inside: avoid;
}

.exam-question-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.q-number-badge {
    font-weight: 700;
    color: var(--primary);
    margin-left: 8px;
}

.q-mark-badge {
    font-size: 0.88rem;
    color: #334155;
    background: #ffffff;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid #cbd5e1;
}

.exam-question-body {
    padding: 16px;
}

.q-text-content {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 14px;
    line-height: 1.65;
}

.q-options-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.q-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    font-size: 0.92rem;
}

.q-option-item.opt-selected-correct {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
    font-weight: 600;
}

.q-option-item.opt-selected-wrong {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
    font-weight: 600;
}

.q-option-item.opt-correct {
    border-color: #86efac;
    background: #f0fdf4;
}

.student-choice-tag {
    margin-right: auto;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(15, 52, 96, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.q-answer-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.92rem;
}

@media print {
    .no-print, .footer {
        display: none !important;
    }
    body {
        background: #ffffff;
    }
    .course-card {
        box-shadow: none;
        border: 1px solid #cbd5e1;
    }
}

.submission-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 0.88rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 6px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* Footer */
.footer {
    margin-top: auto;
    background: #ffffff;
    border-top: 1px solid var(--card-border);
    padding: 18px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.86rem;
}
