:root {
    --maroon-900: #3D0C13;
    --maroon-800: #5A121C;
    --maroon-700: #7A1F2B;
    --maroon-600: #92283A;
    --gold-600: #A9821E;
    --gold-500: #C9A227;
    --gold-300: #E7CE85;
    --gold-100: #FBF3DC;
    --ink-900: #1C1917;
    --ink-700: #433D38;
    --ink-500: #6E655C;
    --paper-50: #FAF7F1;
    --paper-100: #F2EBDD;
    --white: #FFFFFF;
    --border-soft: #E7DFCF;
    --text-body: var(--ink-900);
    --text-muted: var(--ink-500);
    --font-display: 'Almarai', 'Tajawal', sans-serif;
    --font-body: 'Tajawal', 'Almarai', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 8px rgba(61, 12, 19, 0.06);
    --shadow-md: 0 10px 30px rgba(61, 12, 19, 0.10);
    --shadow-gold: 0 6px 18px rgba(169, 130, 30, 0.25);
    --transition: 200ms ease;
    --max-width: 1180px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--paper-50);
    color: var(--text-body);
    line-height: 1.8;
    font-size: 17px;
}

img { max-width: 100%; display: block; }

.container {
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: 20px;
}

a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
    outline: 3px solid var(--gold-500);
    outline-offset: 2px;
    border-radius: 4px;
}

.site-header {
    background: linear-gradient(160deg, var(--maroon-700) 0%, var(--maroon-800) 55%, var(--maroon-900) 100%);
    color: var(--white);
    padding: 0.4rem 0;
    box-shadow: var(--shadow-md);
    border-bottom: 3px solid var(--gold-500);
}

.header-content { display: flex; align-items: center; justify-content: center; }

.brand { display: flex; align-items: center; gap: 1.1rem; }

.logo-frame {
    width: 80px;
    height: 80px;
    background: var(--white);
    border: 2px solid var(--gold-500);
    border-radius: 25%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    flex-shrink: 0;
}

.brand-text .eyebrow {
    font-size: 0.85rem;
    color: var(--gold-300);
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.brand-text h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
}

.main-content { padding: 2.2rem 0 3rem; }

.intro-card {
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1.6rem 1.8rem;
    text-align: center;
    margin-bottom: 2rem;
    border-top: 4px solid var(--gold-500);
    box-shadow: var(--shadow-sm);
}
.intro-card .lead { font-size: 1.1rem; color: var(--maroon-800); font-weight: 600; }

.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.program-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.8rem;
    text-decoration: none;
    color: var(--text-body);
    box-shadow: var(--shadow-sm);
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
    overflow: hidden;
}

.program-card::before {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--maroon-700), var(--gold-500));
}

.program-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--gold-300);
}

.program-card h2 {
    font-family: var(--font-display);
    color: var(--maroon-800);
    font-size: 1.3rem;
    font-weight: 800;
}

.program-card p { color: var(--text-muted); font-size: 0.95rem; }

.program-card-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
}
.status-active { background: var(--gold-100); color: var(--maroon-800); }
.status-pending { background: var(--paper-100); color: var(--ink-500); }

.program-card-count {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--gold-600);
}

.program-card-cta {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--maroon-700);
    transition: gap 200ms ease;
}
.program-card:hover .program-card-cta { gap: 0.8rem; }

.program-card-note {
    font-size: 0.85rem;
    color: var(--ink-500);
    font-style: italic;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--maroon-700);
    text-decoration: none;
    font-weight: 700;
    margin-bottom: 1.5rem;
    transition: gap 200ms ease;
}
.btn-back:hover { gap: 0.8rem; }

.alert-note {
    background: var(--gold-100);
    border-right: 4px solid var(--gold-600);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-align: center;
}

.program-header {
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1.6rem 1.8rem;
    margin-bottom: 1.6rem;
    text-align: center;
    border-top: 4px solid var(--maroon-700);
}
.program-header h2 { font-family: var(--font-display); color: var(--maroon-800); font-size: 1.5rem; font-weight: 800; }
.program-header p { color: var(--text-muted); margin-top: 0.4rem; }
.program-header .batch-label { color: var(--gold-600); font-weight: 700; font-size: 1.05rem; margin-top: 0.3rem; }
.results-count {
    display: inline-block;
    margin-top: 0.7rem;
    background: var(--gold-100);
    color: var(--maroon-800);
    font-weight: 700;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.admission-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--paper-100);
    border: 1px solid var(--gold-300);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1.2rem;
    margin-bottom: 1.6rem;
    text-align: center;
    font-size: 0.95rem;
    color: var(--ink-700);
}
.admission-notice i { color: var(--maroon-700); }
.admission-notice a {
    color: var(--maroon-700);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--gold-500);
}
.admission-notice a:hover { color: var(--maroon-900); }

.table-section {
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1.6rem;
    box-shadow: var(--shadow-sm);
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 1.2rem;
}

.toolbar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--paper-50);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 0.55rem 1rem;
    flex: 1;
    min-width: 200px;
}
.toolbar-search i { color: var(--maroon-700); }
.toolbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    width: 100%;
    color: var(--text-body);
}

.toolbar-filter select {
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--paper-50);
    color: var(--text-body);
}

.btn-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(to bottom, var(--maroon-700), var(--maroon-900));
    color: var(--white);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: transform 200ms ease, box-shadow 200ms ease;
    box-shadow: var(--shadow-sm);
}
.btn-brand:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--gold-100);
    color: var(--maroon-700);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--gold-300);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease;
}
.btn-inline:hover:not(:disabled) { background: var(--gold-300); }
.btn-inline:disabled { opacity: 0.4; cursor: not-allowed; }

.table-wrapper { overflow-x: auto; }

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    min-width: 600px;
}

.results-table thead tr {
    background: linear-gradient(to left, var(--maroon-700), var(--maroon-900));
    color: var(--white);
}

.results-table th, .results-table td {
    padding: 0.8rem 0.9rem;
    text-align: center;
}

.results-table th.is-sortable { cursor: pointer; user-select: none; }
.results-table th.is-sortable:hover { background: rgba(255,255,255,0.08); }
.results-table th.sort-asc::after { content: ' \25B2'; font-size: 0.7em; }
.results-table th.sort-desc::after { content: ' \25BC'; font-size: 0.7em; }

.results-table tbody tr:nth-of-type(even) { background: var(--paper-100); }
.results-table tbody tr:hover { background: var(--gold-100); }
.results-table tbody tr:not(:last-child) { border-bottom: 1px solid var(--border-soft); }

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.2rem;
}
.page-info { font-weight: 700; color: var(--maroon-800); font-size: 0.88rem; }

.site-footer {
    background: linear-gradient(160deg, var(--maroon-900), var(--ink-900));
    color: var(--paper-50);
    padding: 2.2rem 0;
    text-align: center;
    border-top: 3px solid var(--gold-500);
}

.footer-links h2 {
    font-family: var(--font-display);
    color: var(--gold-300);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}
.footer-links ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.footer-links a {
    color: var(--paper-100);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease, color 200ms ease;
}
.footer-links a:hover { color: var(--gold-300); border-color: var(--gold-300); }

.footer-brand { font-weight: 700; margin-bottom: 0.6rem; }
.footer-line { color: var(--gold-300); font-size: 0.9rem; }
.footer-rights { color: var(--paper-100); font-size: 0.82rem; opacity: 0.85; margin-top: 0.3rem; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 450ms ease, transform 450ms ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .program-card, .btn-brand, .btn-back, .btn-inline { transition: none; }
}

@media (max-width: 768px) {
    body { font-size: 16px; }
    .brand-text h1 { font-size: 1.2rem; }
    .logo-frame { width: 58px; height: 58px; }
    .programs-grid { grid-template-columns: 1fr; }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-search { min-width: 0; }
}
