:root {
  --blue: #1e40af; --blue2: #2563eb; --blue3: #3b82f6; --blue-bg: #eff6ff; --blue-border: #bfdbfe;
  --green: #16a34a; --green-bg: #f0fdf4; --gray: #64748b; --gray-light: #f1f5f9; --text: #0f172a;
  --red: #dc2626; --amber: #d97706; --radius: 14px; --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 14px rgba(15,23,42,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Tajawal', 'Cairo', sans-serif; background: #f8fafc; color: var(--text); line-height: 1.7; direction: rtl; }
a { color: var(--blue2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
h1,h2,h3,h4 { font-family: 'Cairo', 'Tajawal', sans-serif; line-height: 1.4; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 14px; padding: 10px 16px; max-width: 1100px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.3rem; color: var(--blue); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 38px; height: 38px; background: linear-gradient(135deg, var(--blue2), var(--blue3)); border-radius: 11px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.2rem; font-weight: 900; }
.logo small { display: block; font-size: .62rem; color: var(--gray); font-weight: 500; }
.main-nav { display: flex; gap: 2px; margin-inline-start: auto; align-items: center; }
.main-nav a { color: var(--text); padding: 7px 11px; border-radius: 9px; font-size: .92rem; font-weight: 500; }
.main-nav a:hover { background: var(--blue-bg); color: var(--blue); text-decoration: none; }
.nav-bell { position: relative; background: none; border: none; font-size: 1.15rem; padding: 6px; border-radius: 9px; }
.nav-bell:hover { background: var(--blue-bg); }
.bell-badge { position: absolute; top: 0; inset-inline-start: 0; background: var(--red); color: #fff; font-size: .62rem; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--blue2); color: #fff; border: none; padding: 10px 20px; border-radius: 11px; font-size: .95rem; font-weight: 700; transition: background .15s, transform .1s; }
.btn:hover { background: var(--blue); text-decoration: none; color: #fff; }
.btn:active { transform: scale(.98); }
.btn-outline { background: #fff; color: var(--blue2); border: 1.5px solid var(--blue-border); }
.btn-outline:hover { background: var(--blue-bg); color: var(--blue); }
.btn-green { background: var(--green); } .btn-green:hover { background: #15803d; }
.btn-sm { padding: 6px 13px; font-size: .85rem; border-radius: 9px; }
.btn-danger { background: #fff; color: var(--red); border: 1.5px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; color: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--blue); }

/* Hero */
.hero { background: linear-gradient(160deg, var(--blue) 0%, var(--blue2) 55%, var(--blue3) 100%); color: #fff; padding: 54px 16px 60px; text-align: center; border-radius: 0 0 28px 28px; }
.hero h1 { font-size: 2.1rem; margin-bottom: 12px; }
.hero p { font-size: 1.08rem; opacity: .92; max-width: 640px; margin: 0 auto 26px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .btn { background: #fff; color: var(--blue); }
.hero .btn:hover { background: var(--blue-bg); }
.hero .btn-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1.5px solid rgba(255,255,255,.45); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.25); color: #fff; }
.hero-stats { display: flex; gap: 30px; justify-content: center; margin-top: 38px; flex-wrap: wrap; }
.hero-stat b { font-size: 1.7rem; display: block; }
.hero-stat span { font-size: .85rem; opacity: .85; }

/* Sections & cards */
.section { padding: 42px 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 10px; flex-wrap: wrap; }
.section-title h2 { font-size: 1.4rem; color: var(--blue); }
.section-title p { color: var(--gray); font-size: .92rem; width: 100%; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
a.card { color: inherit; display: block; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 6px 22px rgba(30,64,175,.13); text-decoration: none; }
.card .icon { font-size: 1.9rem; margin-bottom: 10px; }
.card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.card p { color: var(--gray); font-size: .9rem; }
.card-blue { background: var(--blue-bg); border-color: var(--blue-border); }
.card-green { background: var(--green-bg); border-color: #bbf7d0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); padding: 3px 11px; border-radius: 999px; font-size: .76rem; font-weight: 500; }
.chip-green { background: var(--green-bg); color: var(--green); border-color: #bbf7d0; }
.chip-gray { background: var(--gray-light); color: var(--gray); border-color: #e2e8f0; }
.progress-bar { background: #e2e8f0; border-radius: 999px; height: 9px; overflow: hidden; margin-top: 8px; }
.progress-fill { background: linear-gradient(90deg, var(--blue3), var(--green)); height: 100%; border-radius: 999px; transition: width .4s; }
.meta-row { display: flex; gap: 14px; color: var(--gray); font-size: .82rem; margin-top: 10px; flex-wrap: wrap; }
.badge-lock { background: #fef3c7; color: var(--amber); border: 1px solid #fde68a; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-verified { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-review { background: #fef3c7; color: var(--amber); border: 1px solid #fde68a; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }

/* Forms */
.form-card { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); max-width: 480px; margin: 30px auto; }
.form-card h2 { color: var(--blue); margin-bottom: 18px; text-align: center; }
.field { margin-bottom: 15px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px; background: #fff; transition: border .15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue3); box-shadow: 0 0 0 3px var(--blue-bg); }
.field small { color: var(--gray); font-size: .78rem; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-pill { border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 8px 10px; font-size: .87rem; cursor: pointer; text-align: center; background: #fff; }
.check-pill.on { background: var(--blue-bg); border-color: var(--blue2); color: var(--blue); font-weight: 700; }
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }
.msg-ok { background: var(--green-bg); color: #166534; border: 1px solid #bbf7d0; }
.msg-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.msg-info { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); }

/* Dashboard widgets */
.dash-hero { background: linear-gradient(135deg, var(--blue), var(--blue2)); color: #fff; border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.dash-hero h2 { margin-bottom: 4px; }
.widget { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.widget h3 { font-size: 1rem; color: var(--blue); margin-bottom: 12px; }
.stat-num { font-size: 1.9rem; font-weight: 800; color: var(--blue); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.list-row:last-child { border-bottom: none; }

/* Lesson page */
.lesson-body { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 26px; line-height: 2; font-size: 1.03rem; white-space: pre-wrap; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* Quiz */
.quiz-q { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.quiz-opt { display: block; width: 100%; text-align: start; background: var(--gray-light); border: 1.5px solid transparent; border-radius: 10px; padding: 11px 14px; margin-top: 8px; font-size: .95rem; }
.quiz-opt:hover { border-color: var(--blue3); }
.quiz-opt.sel { background: var(--blue-bg); border-color: var(--blue2); color: var(--blue); font-weight: 700; }
.quiz-opt.correct { background: var(--green-bg); border-color: var(--green); }
.quiz-opt.wrong { background: #fef2f2; border-color: var(--red); }
.score-circle { width: 130px; height: 130px; border-radius: 50%; margin: 10px auto; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; color: #fff; }

/* Tables (admin) */
.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; background: #fff; }
.tbl th { background: var(--blue-bg); color: var(--blue); padding: 10px; text-align: start; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; }
.tbl tr:hover td { background: #f8fafc; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-tabs button { background: #fff; border: 1.5px solid #e2e8f0; padding: 7px 14px; border-radius: 9px; font-size: .85rem; }
.admin-tabs button.on { background: var(--blue2); color: #fff; border-color: var(--blue2); }

/* Notifications & misc */
.notif-item { padding: 13px 16px; border-radius: 11px; background: #fff; border: 1px solid #e2e8f0; margin-bottom: 9px; }
.notif-item.unread { border-inline-start: 4px solid var(--blue2); background: var(--blue-bg); }
.empty { text-align: center; padding: 46px 20px; color: var(--gray); }
.empty .big { font-size: 2.6rem; margin-bottom: 10px; }
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); min-height: 110px; }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 34px; height: 34px; border: 3.5px solid var(--blue-border); border-top-color: var(--blue2); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadein .3s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.src-box { background: var(--gray-light); border-radius: 10px; padding: 13px 16px; font-size: .85rem; color: var(--gray); margin-top: 14px; }
.src-box b { color: var(--text); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--blue-bg); border: 2px solid var(--blue-border); }
.footer { background: #0b2545; color: #cbd5e1; padding: 40px 16px 24px; margin-top: 50px; }
.footer a { color: #93c5fd; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; max-width: 1100px; margin: 0 auto 26px; }
.footer h4 { color: #fff; margin-bottom: 10px; font-size: .95rem; }
.footer a { display: block; font-size: .86rem; padding: 3px 0; }
.footer-bottom { text-align: center; border-top: 1px solid #1e3a5f; padding-top: 18px; font-size: .82rem; color: #64748b; max-width: 1100px; margin: 0 auto; }
.cv-paper { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 34px; max-width: 760px; margin: 0 auto; box-shadow: var(--shadow); }
.cv-paper h1 { color: var(--blue); font-size: 1.5rem; }
.cv-sec { margin-top: 18px; } .cv-sec h3 { color: var(--blue2); border-bottom: 2px solid var(--blue-border); padding-bottom: 4px; font-size: 1.02rem; margin-bottom: 8px; }
.task-day { border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.task-day-head { background: var(--blue-bg); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 700; color: var(--blue); font-size: .93rem; }
.task-day-body { padding: 12px 16px; background: #fff; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed #f1f5f9; font-size: .92rem; }
@media (max-width: 820px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 1.6rem; }
  .main-nav { display: none; position: absolute; top: 58px; inset-inline-start: 0; inset-inline-end: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 10px; border-bottom: 2px solid var(--blue-border); box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .menu-toggle { display: block; margin-inline-start: auto; }
  .nav-auth-desktop { display: none; }
}
@media (max-width: 480px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media print { .site-header, .footer, .btn, .no-print { display: none !important; } body { background: #fff; } .cv-paper { border: none; box-shadow: none; padding: 0; } }
