/* ==========================================================================
   LearnX — نظام التصميم الموحّد (home.php + index.php)
   المرجع: الصفحة الرئيسية. كحلي غامق #0B132B · سيان #00B4D8 · بنفسجي #7B2CBF
   الخط: Tajawal. الوضعين (فاتح/داكن) بنفس المتغيرات، فغيّر اللون من هنا بس.
   ========================================================================== */
:root {
  --bg: #f3f7ff;
  --bg-alt: #e6eefc;
  --bg-header: rgba(255, 255, 255, .92);
  --card: #ffffff;
  --card-border: rgba(11, 19, 43, .12);
  --text: #0B132B;
  --muted: #4a5a78;
  --accent: #00B4D8;
  --accent-text: #0077b6;
  --purple: #7B2CBF;
  --purple-dark: #5a1e90;
  --grid: rgba(11, 19, 43, .07);
  --badge-bg: rgba(0, 180, 216, .12);
  --field: #ffffff;
  --field-border: rgba(11, 19, 43, .2);
  --soft: #eaf1fc;
  --ok: #0f9d77;
  --shadow: 0 10px 30px rgba(11, 19, 43, .12);
  --shadow-h: 0 16px 38px rgba(11, 19, 43, .18);
  --r: 14px;
  --navy-1: #0B132B;
  --navy-2: #14213D;
  --font: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}
body.dark-mode {
  --bg: #0B132B;
  --bg-alt: #0d1836;
  --bg-header: rgba(11, 19, 43, .9);
  --card: #111c3a;
  --card-border: rgba(255, 255, 255, .1);
  --text: #FFFFFF;
  --muted: #A3BAC3;
  --accent-text: #00B4D8;
  --grid: rgba(255, 255, 255, .05);
  --badge-bg: rgba(0, 180, 216, .1);
  --field: #0d1836;
  --field-border: rgba(255, 255, 255, .2);
  --soft: #16254a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-h: 0 16px 40px rgba(0, 0, 0, .5);
}

/* ---------- الأساسيات ---------- */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}
h1, h2, h3, h4, .section-title, .category-title, .feature-title, .auth-title, .session-title,
.unit-card h4, .unit-header h3, .subject-icon-card h3, .profile-title, .unit-code-title, .resource-header h3 {
  font-family: var(--font);
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text);
}
input, button, select, textarea { font-family: inherit; }
::selection { background: rgba(0, 180, 216, .3); }
:focus-visible { outline: 3px solid rgba(0, 180, 216, .5); outline-offset: 2px; border-radius: 8px; }

@keyframes lxFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- الشريط العلوي ---------- */
.topbar {
  background: var(--bg-header);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  box-shadow: none;
  padding: 12px 5%;
  gap: 12px;
}
.logo { gap: 10px; text-decoration: none; align-items: center; }
.logo img { height: 40px; width: auto; display: block; }
.logo-text {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: 2px;
  color: var(--text);
  direction: ltr;
  line-height: 1;
}
.logo-text b { color: var(--accent); font-weight: 800; }
.topbar-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 14px;
  transition: .25s;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent-text); background: var(--badge-bg); }
.topbar-btn i { color: var(--accent-text); }

/* شريط حماية الجهاز */
.security-banner {
  background: var(--badge-bg);
  color: var(--text);
  border-bottom: 1px solid var(--card-border);
  font-size: .86rem;
  font-weight: 500;
  padding: 8px 5%;
  margin-bottom: 0;
}
.security-banner i { color: var(--accent-text); }
.device-alert { background: #b42318; border-radius: 0; box-shadow: none; font-weight: 700; }

/* ---------- الهيدر الغامق (شبكة Blueprint + قلم = X اللوجو) ---------- */
.section-header, .session-header {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, var(--navy-1) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 56px 5% 46px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.section-header::before, .session-header::before {
  content: '';
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(56, 189, 248, .55) 1px, transparent 1px), linear-gradient(90deg, rgba(56, 189, 248, .55) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: .08;
}
.section-header::after, .session-header::after {
  content: '';
  position: absolute; z-index: -1; pointer-events: none;
  top: 50%; inset-inline-end: 7%;
  width: 330px; height: 44px; border-radius: 40px;
  background: linear-gradient(90deg, rgba(0, 180, 216, 0), rgba(0, 180, 216, .35));
  transform: translateY(-50%) rotate(40deg);
}
.section-header > *, .session-header > * { position: relative; z-index: 1; }
.section-header h1, .section-header h2, .session-header h1 {
  color: #fff;
  font-weight: 800;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  text-shadow: none;
  line-height: 1.3;
}
.section-header p, .session-header p { color: #b8c9e6; }
.back-btn {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  font-weight: 700;
  font-size: .92rem;
  padding: 8px 16px;
  text-decoration: none;
  color: #fff;
}
.back-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--navy-1); }
.section-content { padding: 40px 5% 56px; }
.section-title { color: var(--text); }
.section-title i { color: var(--accent-text); }

/* ---------- البطاقات ---------- */
.category-card, .feature-card, .subject-icon-card, .unit-card, .subject-box, .resource-card,
.auth-card, .profile-card, .unit-code-card, .lesson-item, .quiz-card, .session-locked-view,
.session-nav, .material-item {
  background-color: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  color: var(--text);
}
/* بطاقات "الشبكة" زي كارت الهندسة في الهوم */
.category-card, .subject-icon-card, .unit-card, .feature-card {
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 20px 20px;
}
.category-card, .feature-card, .subject-icon-card, .unit-card, .lesson-item {
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.category-card:hover, .feature-card:hover, .subject-icon-card:hover, .unit-card:hover, .lesson-item:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: var(--shadow-h);
}
.category-card { padding: 30px 26px; position: relative; overflow: hidden; }
.category-card::before {
  content: '';
  position: absolute; inset-inline: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
}
.category-icon, .feature-icon {
  width: 60px; height: 60px;
  display: inline-grid; place-items: center;
  font-size: 1.6rem;
  color: var(--accent-text);
  background: var(--badge-bg);
  border: 1px solid rgba(0, 180, 216, .45);
  border-radius: 14px;
  margin-bottom: 16px;
  animation: lxFloat 4.5s ease-in-out infinite;
}
.categories-container > :nth-child(2) .category-icon { color: #9d4edd; background: rgba(123, 44, 191, .14); border-color: rgba(157, 78, 221, .5); animation-delay: .6s; }
.categories-container > :nth-child(3) .category-icon { animation-delay: 1.2s; }
.category-title { font-size: 1.35rem; margin-bottom: 6px; }
.category-desc { color: var(--muted); font-size: .98rem; margin-top: 4px; }
.dashboard h1, .dashboard .welcome { font-family: var(--font); font-weight: 800; color: var(--text); }

/* كروت الشهور والمواد */
.unit-card, .subject-icon-card { padding: 22px; position: relative; }
.unit-card h4, .subject-icon-card h3 { font-size: 1.15rem; margin: 10px 0 4px; }
.unit-card p, .subject-icon-card p { color: var(--muted); font-size: .92rem; }
.subject-icon-card i, .unit-card > i { color: var(--accent-text); }
.subject-icon-card:hover h3, .subject-icon-card:hover p { color: inherit; }
.section-content h2 {
  font-weight: 800; font-size: 1.4rem; color: var(--text);
  display: flex; align-items: center; gap: 10px; margin: 0 0 18px;
}
.section-content h2 i { color: var(--accent-text); font-size: 1.05rem; }
.subjects-selector { gap: 18px; }
a.subject-icon-card, .subject-icon-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  text-decoration: none; text-align: start; min-height: 168px; padding: 22px 22px 20px;
  position: relative; color: var(--text);
}
.subject-icon-card > i {
  width: 54px; height: 54px; display: grid; place-items: center;
  font-size: 1.4rem; border-radius: 14px; margin-bottom: 8px;
  background: var(--badge-bg); color: var(--accent-text);
  border: 1px solid rgba(0, 180, 216, .4);
  transition: .25s;
}
.subject-icon-card h3 { margin: 2px 0 0; font-size: 1.2rem; }
.subject-icon-card p { margin: 0; }
.lock-icon {
  position: absolute; top: 16px; inset-inline-end: 16px; inset-inline-start: auto;
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; background: var(--soft); border: 1px solid var(--card-border);
  color: var(--muted); font-size: .9rem;
}
.lock-icon i { font-size: .9rem; color: inherit; }
.lock-icon.unlocked { background: rgba(15, 157, 119, .15); color: var(--ok); border-color: rgba(15, 157, 119, .4); }
.subject-icon-card:hover > i { background: var(--accent); color: var(--navy-1); border-color: var(--accent); }
.unit-header {
  background: linear-gradient(135deg, var(--navy-1), var(--navy-2));
  color: #fff; border-radius: 14px 14px 0 0;
}
.unit-header h3, .unit-header i { color: #fff; }

/* ---------- الأزرار ---------- */
.btn, .auth-btn, .quiz-btn, .open-btn, .retry-btn, .download-btn, .cta-buttons a {
  font-family: var(--font);
  font-weight: 700;
  border-radius: 8px;
  border: 0;
  letter-spacing: 0;
  box-shadow: none;
  transition: background .25s, transform .2s, box-shadow .25s;
}
.btn-primary, .auth-btn, .quiz-btn {
  background: var(--purple);
  color: #fff;
}
.btn-primary:hover, .auth-btn:hover, .quiz-btn:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(123, 44, 191, .35);
}
.open-btn { background: var(--accent); color: var(--navy-1); font-weight: 800; }
.open-btn:hover { background: #0096b4; transform: translateY(-1px); }
.btn-secondary, .download-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--field-border);
}
.btn-secondary:hover, .download-btn:hover { border-color: var(--accent); color: var(--accent-text); background: var(--badge-bg); transform: none; }
.whatsapp-btn { border-radius: 8px; font-weight: 700; box-shadow: none; }

/* ---------- الفورم ---------- */
.auth-container {
  padding: 32px 16px 52px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
.auth-card { padding: 34px 32px; border-radius: 16px; }
.auth-title { font-size: 1.7rem; text-align: center; margin-bottom: 20px; }
.form-group label { font-weight: 700; font-size: .95rem; color: var(--text); margin-bottom: 6px; }
.form-group input, .code-input, .verification-code-input, input[type=text], input[type=password], input[type=email], input[type=tel] {
  font-family: var(--font);
  font-size: 1rem;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--field);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus, .code-input:focus, .verification-code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 180, 216, .16);
  outline: none;
}
.auth-footer a, .back-to-dashboard { color: var(--accent-text); font-weight: 700; }
.message, .error-message, .success-message, .code-info-box, .verification-info { border-radius: 10px; font-size: .95rem; }
.code-info-box, .verification-info { background: var(--badge-bg); border: 1px solid rgba(0, 180, 216, .35); color: var(--text); }
.code-info-box h4, .verification-info h4 { color: var(--accent-text); }
.unit-code-icon, .profile-avatar {
  background: linear-gradient(135deg, var(--navy-2), var(--purple));
  box-shadow: 0 8px 20px rgba(123, 44, 191, .3);
  color: #fff;
}

/* ---------- الحصص ---------- */
.session-nav { padding: 10px 12px; border-radius: 14px; }
.session-tabs { gap: 8px; flex-wrap: wrap; }
.session-tab {
  font-family: var(--font);
  font-weight: 700;
  font-size: .95rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 9px 20px;
  box-shadow: none;
  transition: .25s;
}
.session-tab:hover { border-color: var(--accent); background: var(--badge-bg); }
.session-tab.active, body:not(.dark-mode) .session-tab.active {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  box-shadow: 0 6px 16px rgba(123, 44, 191, .35);
}
.session-tab.locked { opacity: .6; }
.session-title { font-size: clamp(1.3rem, 2.4vw, 1.9rem); }
.session-subtitle { color: var(--muted); }
.session-header .session-title { color: #fff; }
.session-header .session-subtitle { color: #b8c9e6; }
.resource-header { border-bottom: 1px solid var(--card-border); }
.resource-header i { color: var(--accent-text); }
.resource-item:hover, .material-item:hover { background: var(--badge-bg); }
.material-item.active { background: var(--badge-bg); border-color: var(--accent); }
.video-container, .video-wrapper { border-radius: 14px; overflow: hidden; }
.profile-field { border-radius: 10px; background: var(--soft); border: 1px solid var(--card-border); }
.profile-badge { background: rgba(15, 157, 119, .15); color: var(--ok); border-radius: 999px; font-weight: 700; }

/* مشغّل الحصة (من lx.php) على نفس الألوان */
body .lxp { --lx-bg: var(--card); --lx-bd: var(--card-border); --lx-tx: var(--text); --lx-mu: var(--muted); --lx-ac: var(--purple); --lx-ok: var(--ok); --lx-soft: var(--soft); }
body.dark-mode .lxp { --lx-ac: #00B4D8; }

/* ---------- الفوتر + السوشيال (زي الهوم) ---------- */
.site-footer {
  background: #050a17;
  color: #A3BAC3;
  border-top: 1px solid rgba(255, 255, 255, .05);
  padding: 48px 5% 24px;
  text-align: center;
  margin-top: 56px;
}
.foot-inner { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.foot-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.foot-name { font-family: var(--font); font-weight: 800; font-size: 1.9rem; letter-spacing: 2px; color: #fff; direction: ltr; }
.foot-name b { color: var(--accent); font-weight: 800; }
.foot-tag { font-size: .98rem; color: #A3BAC3; }
.social-icons { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.social-icons a {
  width: 44px; height: 44px; line-height: 1; margin: 0;
  display: inline-grid; place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #A3BAC3;
  font-size: 1.15rem;
  transition: .25s;
}
.social-icons a:hover { background: var(--accent); border-color: var(--accent); color: var(--navy-1); transform: translateY(-3px); }
.foot-contact { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 12px; font-size: .96rem; }
.foot-contact a { color: #cfe0ea; text-decoration: none; font-weight: 500; }
.foot-contact a:hover { color: var(--accent); }
.foot-contact span { color: #4d6385; }
.copyright-text { font-size: .86rem; color: #7f93b0; line-height: 1.8; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; width: 100%; margin: 0; }

/* ---------- موبايل ---------- */
@media (max-width: 760px) {
  .topbar { padding: 8px 4%; flex-wrap: nowrap; min-height: 58px; }
  .logo img { height: 32px; }
  .logo-text { font-size: 1.3rem; letter-spacing: 1px; }
  .topbar-actions { width: auto; flex-wrap: nowrap; gap: 4px; }
  .topbar-btn { font-size: 0; padding: 9px 10px; flex: 0 0 auto; line-height: 1; }
  .topbar-btn i { font-size: 1.05rem; margin: 0; }
  .topbar-btn span { display: none; }
  .session-tabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding: 2px; }
  .session-tabs::-webkit-scrollbar { display: none; }
  .session-tab { flex: 0 0 auto; flex-direction: row; padding: 8px 16px; font-size: .88rem; white-space: nowrap; }
  .section-header, .session-header { padding: 74px 5% 32px; }
  .section-header::after, .session-header::after { width: 210px; opacity: .6; }
  .auth-card { padding: 26px 20px; }
  .categories-container { gap: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
