/* ============================================================
   BOOTCAMP — Global Stylesheet
   Direction: RTL | Font: Tajawal (Arabic)
   ============================================================ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

/* ── CSS Variables ───────────────────────────────────────── */
:root {
    --clr-bg:          #0d1117;
    --clr-surface:     #161b22;
    --clr-surface-2:   #21262d;
    --clr-border:      #30363d;
    --clr-primary:     #2ea043;
    --clr-primary-h:   #3fb950;
    --clr-primary-dim: #1a3a22;
    --clr-accent:      #58a6ff;
    --clr-accent-dim:  #1b3a5c;
    --clr-danger:      #f85149;
    --clr-danger-dim:  #3d1a19;
    --clr-warning:     #d29922;
    --clr-warning-dim: #3a2a0a;
    --clr-text:        #e6edf3;
    --clr-text-muted:  #8b949e;
    --clr-text-faint:  #484f58;
    --radius-sm:       6px;
    --radius-md:       12px;
    --radius-lg:       20px;
    --shadow-card:     0 4px 24px rgba(0,0,0,.45);
    --transition:      .2s ease;
    --font:            'Tajawal', sans-serif;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background:  var(--clr-bg);
    color:       var(--clr-text);
    direction:   rtl;
    min-height:  100vh;
    line-height: 1.7;
}

a { color: var(--clr-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--clr-primary-h); }

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

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--clr-surface); }
::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--clr-text-muted); }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.3; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--clr-text-muted); }

/* ── Layout helpers ──────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
    background:    var(--clr-surface);
    border:        1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding:       2rem;
    box-shadow:    var(--shadow-card);
}

.card-sm  { max-width: 460px;  width: 100%; }
.card-md  { max-width: 640px;  width: 100%; }
.card-lg  { max-width: 900px;  width: 100%; }
.card-xl  { max-width: 1100px; width: 100%; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
    background:   var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding:       0 1.25rem;
    height:        64px;
    display:       flex;
    align-items:   center;
    position:      sticky;
    top:           0;
    z-index:       100;
}

.navbar .container {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    width:           100%;
}

.navbar-brand {
    font-size:   1.3rem;
    font-weight: 800;
    color:       var(--clr-primary-h) !important;
    display:     flex;
    align-items: center;
    gap:         .5rem;
}

.navbar-brand span { color: var(--clr-text); }

.navbar-nav {
    display:     flex;
    align-items: center;
    gap:         .25rem;
    list-style:  none;
}

.navbar-nav a {
    color:         var(--clr-text-muted);
    padding:       .45rem .85rem;
    border-radius: var(--radius-sm);
    font-size:     .95rem;
    transition:    background var(--transition), color var(--transition);
}

.navbar-nav a:hover,
.navbar-nav a.active {
    background: var(--clr-surface-2);
    color:      var(--clr-text);
}

.navbar-user {
    display:       flex;
    align-items:   center;
    gap:           .6rem;
    font-size:     .9rem;
    color:         var(--clr-text-muted);
}

.navbar-user .avatar {
    width:         36px;
    height:        36px;
    border-radius: 50%;
    background:    var(--clr-primary-dim);
    color:         var(--clr-primary-h);
    display:       flex;
    align-items:   center;
    justify-content: center;
    font-weight:   700;
    font-size:     1rem;
    flex-shrink:   0;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display:       block;
    margin-bottom: .45rem;
    font-size:     .9rem;
    font-weight:   500;
    color:         var(--clr-text);
}

.form-label .required { color: var(--clr-danger); margin-right: .15rem; }

.form-control {
    width:         100%;
    padding:       .65rem 1rem;
    background:    var(--clr-surface-2);
    border:        1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    color:         var(--clr-text);
    font-family:   var(--font);
    font-size:     1rem;
    transition:    border-color var(--transition), box-shadow var(--transition);
    direction:     rtl;
}

.form-control:focus {
    outline:      none;
    border-color: var(--clr-primary);
    box-shadow:   0 0 0 3px rgba(46,160,67,.18);
}

.form-control::placeholder { color: var(--clr-text-faint); }

.form-hint {
    margin-top:  .35rem;
    font-size:   .82rem;
    color:       var(--clr-text-muted);
}

.form-error {
    margin-top:  .35rem;
    font-size:   .85rem;
    color:       var(--clr-danger);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             .4rem;
    padding:         .65rem 1.4rem;
    border-radius:   var(--radius-sm);
    font-family:     var(--font);
    font-size:       1rem;
    font-weight:     600;
    cursor:          pointer;
    border:          1px solid transparent;
    transition:      background var(--transition), border-color var(--transition),
                     transform .1s, box-shadow var(--transition);
    text-decoration: none;
    white-space:     nowrap;
}

.btn:active { transform: scale(.97); }

.btn-primary {
    background:   var(--clr-primary);
    border-color: var(--clr-primary);
    color:        #fff;
}
.btn-primary:hover {
    background:   var(--clr-primary-h);
    border-color: var(--clr-primary-h);
    color:        #fff;
    box-shadow:   0 0 12px rgba(46,160,67,.35);
}

.btn-secondary {
    background:   var(--clr-surface-2);
    border-color: var(--clr-border);
    color:        var(--clr-text);
}
.btn-secondary:hover {
    background:   var(--clr-border);
    color:        var(--clr-text);
}

.btn-danger {
    background:   var(--clr-danger);
    border-color: var(--clr-danger);
    color:        #fff;
}
.btn-danger:hover {
    background:   #e5383b;
    color:        #fff;
    box-shadow:   0 0 12px rgba(248,81,73,.35);
}

.btn-accent {
    background:   var(--clr-accent-dim);
    border-color: var(--clr-accent);
    color:        var(--clr-accent);
}
.btn-accent:hover {
    background:   var(--clr-accent);
    color:        var(--clr-bg);
}

.btn-outline {
    background:   transparent;
    border-color: var(--clr-border);
    color:        var(--clr-text-muted);
}
.btn-outline:hover {
    background:   var(--clr-surface-2);
    color:        var(--clr-text);
}

.btn-lg { padding: .85rem 2rem; font-size: 1.1rem; border-radius: var(--radius-md); }
.btn-sm { padding: .35rem .85rem; font-size: .85rem; }
.btn-full { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ── Alerts / Flash ──────────────────────────────────────── */
.alert {
    padding:       .9rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size:     .95rem;
    margin-bottom: 1.2rem;
    border:        1px solid transparent;
    display:       flex;
    align-items:   flex-start;
    gap:           .6rem;
}

.alert-success {
    background:   var(--clr-primary-dim);
    border-color: var(--clr-primary);
    color:        var(--clr-primary-h);
}
.alert-danger {
    background:   var(--clr-danger-dim);
    border-color: var(--clr-danger);
    color:        var(--clr-danger);
}
.alert-warning {
    background:   var(--clr-warning-dim);
    border-color: var(--clr-warning);
    color:        var(--clr-warning);
}
.alert-info {
    background:   var(--clr-accent-dim);
    border-color: var(--clr-accent);
    color:        var(--clr-accent);
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
    display:       inline-flex;
    align-items:   center;
    padding:       .2rem .65rem;
    border-radius: 99px;
    font-size:     .78rem;
    font-weight:   600;
}

.badge-success  { background: var(--clr-primary-dim); color: var(--clr-primary-h); }
.badge-danger   { background: var(--clr-danger-dim);  color: var(--clr-danger); }
.badge-warning  { background: var(--clr-warning-dim); color: var(--clr-warning); }
.badge-info     { background: var(--clr-accent-dim);  color: var(--clr-accent); }
.badge-muted    { background: var(--clr-surface-2);   color: var(--clr-text-muted); }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
    border:        none;
    border-top:    1px solid var(--clr-border);
    margin:        1.5rem 0;
}

/* ── Auth page layout ────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display:    grid;
    grid-template-columns: 1fr 1fr;
}

.auth-hero {
    background:      linear-gradient(135deg, #0d2818 0%, #0d1117 60%, #1b3a5c 100%);
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    padding:         3rem 2rem;
    text-align:      center;
    border-left:     1px solid var(--clr-border);
    gap:             1.5rem;
}

.auth-hero .hero-icon {
    font-size:       5rem;
    line-height:     1;
}

.auth-hero h1 { color: var(--clr-primary-h); font-size: 2.2rem; }
.auth-hero p  { font-size: 1.05rem; max-width: 340px; color: var(--clr-text-muted); }

.auth-form-side {
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         3rem 2rem;
    background:      var(--clr-bg);
}

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap:                   1rem;
    margin-bottom:         1.5rem;
}

.stat-card {
    background:    var(--clr-surface);
    border:        1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding:       1.25rem 1.5rem;
    display:       flex;
    flex-direction: column;
    gap:           .3rem;
}

.stat-card .stat-label {
    font-size:  .82rem;
    color:      var(--clr-text-muted);
    font-weight: 500;
}

.stat-card .stat-value {
    font-size:   2rem;
    font-weight: 800;
    color:       var(--clr-text);
    line-height: 1.1;
}

.stat-card .stat-sub { font-size: .8rem; color: var(--clr-text-faint); }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
    width:           100%;
    border-collapse: collapse;
    font-size:       .92rem;
}

thead th {
    background:    var(--clr-surface-2);
    color:         var(--clr-text-muted);
    font-weight:   600;
    padding:       .75rem 1rem;
    text-align:    right;
    border-bottom: 1px solid var(--clr-border);
    white-space:   nowrap;
}

tbody td {
    padding:       .75rem 1rem;
    border-bottom: 1px solid var(--clr-border);
    color:         var(--clr-text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--clr-surface-2); }

/* ── Progress bar ────────────────────────────────────────── */
.progress {
    height:        8px;
    background:    var(--clr-surface-2);
    border-radius: 99px;
    overflow:      hidden;
}

.progress-bar {
    height:        100%;
    border-radius: 99px;
    background:    var(--clr-primary);
    transition:    width .4s ease;
}

/* ── Countdown timer ─────────────────────────────────────── */
.countdown-ring {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
}

.countdown-ring svg { transform: rotate(-90deg); }

.countdown-ring .ring-bg    { fill: none; stroke: var(--clr-surface-2); stroke-width: 6; }
.countdown-ring .ring-fill  { fill: none; stroke: var(--clr-primary);   stroke-width: 6;
                               stroke-linecap: round; transition: stroke-dashoffset .9s linear,
                               stroke var(--transition); }
.countdown-ring .ring-fill.warning { stroke: var(--clr-warning); }
.countdown-ring .ring-fill.danger  { stroke: var(--clr-danger); }

.countdown-ring .ring-num {
    font-size:   2.2rem;
    font-weight: 800;
    color:       var(--clr-text);
    margin-top:  -.5rem;
}
.countdown-ring .ring-label {
    font-size:  .8rem;
    color:      var(--clr-text-muted);
}

/* ── Exam question card ──────────────────────────────────── */
.question-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   1.5rem;
    gap:             1rem;
}

.question-progress-label {
    font-size:   .85rem;
    color:       var(--clr-text-muted);
    white-space: nowrap;
}

.question-text {
    font-size:     1.15rem;
    font-weight:   500;
    color:         var(--clr-text);
    margin-bottom: 1.5rem;
    line-height:   1.8;
}

.options-list { list-style: none; display: flex; flex-direction: column; gap: .7rem; }

.option-item {
    display:       flex;
    align-items:   flex-start;
    gap:           .8rem;
    padding:       .9rem 1.1rem;
    border:        1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    cursor:        pointer;
    transition:    background var(--transition), border-color var(--transition);
    user-select:   none;
}

.option-item:hover {
    background:    var(--clr-surface-2);
    border-color:  var(--clr-primary);
}

.option-item input[type="radio"] { display: none; }

.option-item.selected {
    background:    var(--clr-primary-dim);
    border-color:  var(--clr-primary);
}

.option-letter {
    width:          28px;
    height:         28px;
    border-radius:  50%;
    background:     var(--clr-surface-2);
    border:         1px solid var(--clr-border);
    display:        flex;
    align-items:    center;
    justify-content: center;
    font-weight:    700;
    font-size:      .85rem;
    flex-shrink:    0;
    transition:     background var(--transition), border-color var(--transition);
}

.option-item.selected .option-letter {
    background:   var(--clr-primary);
    border-color: var(--clr-primary);
    color:        #fff;
}

/* ── Project gallery ─────────────────────────────────────── */
.projects-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap:                   1.25rem;
}

.project-card {
    background:    var(--clr-surface);
    border:        1px solid var(--clr-border);
    border-radius: var(--radius-md);
    overflow:      hidden;
    transition:    border-color var(--transition), transform var(--transition);
}

.project-card:hover {
    border-color: var(--clr-primary);
    transform:    translateY(-3px);
}

.project-card-img {
    width:       100%;
    height:      180px;
    object-fit:  cover;
    background:  var(--clr-surface-2);
}

.project-card-img-placeholder {
    width:           100%;
    height:          180px;
    background:      var(--clr-surface-2);
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       3rem;
    color:           var(--clr-text-faint);
}

.project-card-body { padding: 1rem; }
.project-card-title { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.project-card-desc  { font-size: .85rem; color: var(--clr-text-muted); margin-bottom: .85rem;
                       display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                       overflow: hidden; }
.project-card-footer {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         .75rem 1rem;
    border-top:      1px solid var(--clr-border);
}

/* ── Admin sidebar ───────────────────────────────────────── */
.admin-layout {
    display:    grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background:  var(--clr-surface);
    border-left: 1px solid var(--clr-border);
    padding:     1.5rem 0;
    display:     flex;
    flex-direction: column;
    position:    sticky;
    top:         0;
    height:      100vh;
    overflow-y:  auto;
}

.admin-sidebar .sidebar-title {
    padding:       0 1.5rem 1rem;
    font-size:     .78rem;
    font-weight:   700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color:         var(--clr-text-faint);
    border-bottom: 1px solid var(--clr-border);
    margin-bottom: .5rem;
}

.admin-sidebar nav a {
    display:       flex;
    align-items:   center;
    gap:           .7rem;
    padding:       .6rem 1.5rem;
    color:         var(--clr-text-muted);
    font-size:     .95rem;
    transition:    background var(--transition), color var(--transition);
    border-right:  3px solid transparent;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    background:    var(--clr-surface-2);
    color:         var(--clr-text);
    border-right-color: var(--clr-primary);
}

.admin-main { padding: 2rem; overflow-y: auto; }

.admin-page-title {
    font-size:     1.6rem;
    font-weight:   800;
    margin-bottom: 1.5rem;
    display:       flex;
    align-items:   center;
    gap:           .6rem;
}

/* ── Toggle switch ───────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: .75rem; }

.toggle {
    position: relative;
    width:    48px;
    height:   26px;
    flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position:      absolute;
    inset:         0;
    background:    var(--clr-surface-2);
    border:        1px solid var(--clr-border);
    border-radius: 99px;
    cursor:        pointer;
    transition:    background var(--transition);
}

.toggle-slider::before {
    content:       '';
    position:      absolute;
    width:         18px;
    height:        18px;
    right:         3px;
    top:           3px;
    background:    var(--clr-text-muted);
    border-radius: 50%;
    transition:    transform var(--transition), background var(--transition);
}

.toggle input:checked + .toggle-slider {
    background:   var(--clr-primary);
    border-color: var(--clr-primary);
}

.toggle input:checked + .toggle-slider::before {
    transform:  translateX(-22px);
    background: #fff;
}

/* ── Utilities ───────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-muted   { color: var(--clr-text-muted); }
.text-danger  { color: var(--clr-danger); }
.text-success { color: var(--clr-primary-h); }
.text-accent  { color: var(--clr-accent); }
.text-warning { color: var(--clr-warning); }

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex           { display: flex; }
.flex-center    { display: flex; align-items: center; justify-content: center; }
.flex-between   { display: flex; align-items: center; justify-content: space-between; }
.flex-col       { flex-direction: column; }
.gap-1          { gap: .5rem; }
.gap-2          { gap: 1rem; }
.gap-3          { gap: 1.5rem; }

.w-full         { width: 100%; }
.hidden         { display: none !important; }
.rounded        { border-radius: var(--radius-sm); }
.rounded-full   { border-radius: 99px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar {
        position:  static;
        height:    auto;
        flex-direction: row;
        overflow-x: auto;
        padding:   .5rem 0;
        border-left: none;
        border-bottom: 1px solid var(--clr-border);
    }
    .admin-sidebar .sidebar-title { display: none; }
    .admin-sidebar nav { display: flex; flex-direction: row; }
    .admin-sidebar nav a { padding: .5rem 1rem; border-right: none; border-bottom: 3px solid transparent; }
    .admin-sidebar nav a.active { border-bottom-color: var(--clr-primary); }
}

@media (max-width: 600px) {
    .card { padding: 1.25rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
}
