/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 0;
  flex-shrink: 0;
}

/* Logo / brand */
.navbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  margin-inline-end: 28px;
}

/* Official Jadeer logo */
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

/* Desktop nav links */
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.navbar-nav::-webkit-scrollbar { display: none; }

.nav-link {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--text2);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  transition: background .18s var(--ease), color .18s var(--ease);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-link:hover  { background: var(--surface2); color: var(--text); }
.nav-link.active { background: rgba(124,92,252,.14); color: var(--accent2); font-weight: 600; }

/* Right-side action cluster */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
  padding-inline-start: 12px;
  flex-shrink: 0;
}

/* Hamburger (mobile only) */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-inline-end: 8px;
  transition: background .18s;
}
.hamburger:hover { background: var(--surface2); }

@media (max-width: 900px) {
  .navbar      { padding: 0 16px; }
  .navbar-nav  { display: none; }
  .hamburger   { display: flex; }
  .navbar-brand { margin-inline-end: 0; }
}

/* Light mode navbar — subtle elevation */
[data-theme="light"] .navbar {
  box-shadow: 0 1px 0 var(--border), 0 4px 16px rgba(0,0,0,.04);
}

/* ============================================================
   NAVBAR ACTION CONTROLS
   ============================================================ */
.lang-toggle {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  transition: border-color .18s;
}
.lang-toggle:hover { border-color: var(--accent); }
.lang-icon { width: 18px; height: 18px; object-fit: contain; display: block; border-radius: 2px; }

/* CSS-driven toggle switch — visual state tracks [data-theme] on <html> */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: var(--surface3);
  border: 1.5px solid var(--border2);
  flex-shrink: 0;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
[data-theme="light"] .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text3);
  transition: transform .25s var(--ease), background .25s var(--ease);
}
[data-theme="light"] .switch-thumb {
  transform: translateX(18px);
  background: #fff;
}

.switch-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .5px;
  text-transform: uppercase;
  min-width: 30px;
  text-align: start;
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 13px;
}

/* ============================================================
   MOBILE SLIDE-IN SIDEBAR
   ============================================================ */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 40;
  display: none;
}
.sidebar-backdrop.open { display: block; }

.sidebar {
  position: fixed;
  inset-inline-start: -280px;
  top: 0;
  width: 260px;
  height: 100vh;
  z-index: 50;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: inset-inline-start .28s var(--ease);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
.sidebar.open { inset-inline-start: 0; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 16px;
  transition: background .15s, color .15s;
}
.sidebar-close:hover { background: var(--surface2); color: var(--text); }

.sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text2);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  background: none;
  border: 0;
  width: 100%;
  text-align: start;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.sidebar-nav-item:hover  { background: var(--surface2); color: var(--text); }
.sidebar-nav-item.active { background: rgba(124,92,252,.14); color: var(--accent2); font-weight: 600; }

.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Full-width slot — lives outside the padded .content,
   so the hero spans the entire viewport width naturally. */
.hero-area {
  flex-shrink: 0;
}

/* Standard padded content container */
.content {
  padding: 32px 28px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.page-header {
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.page-header h1 { margin-bottom: 0; }

.page-header .sub {
  color: var(--text2);
  font-size: 14px;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  position: relative;
  min-height: 540px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 100px 32px 90px;
}

/* Gradient lighting */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(124,92,252,.38) 0%, transparent 55%),
    radial-gradient(ellipse at 88% 88%,  rgba(192,132,252,.20) 0%, transparent 45%),
    radial-gradient(ellipse at 8%  80%,  rgba(96,165,250,.12)  0%, transparent 40%);
}
[data-theme="light"] .hero-bg {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(124,92,252,.07) 0%, transparent 55%),
    radial-gradient(ellipse at 88% 88%,  rgba(192,132,252,.04) 0%, transparent 45%);
}

/* Dot-grid pattern */
.hero-dots {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.10) 1px, transparent 1px);
  background-size: 28px 28px;
}
[data-theme="light"] .hero-dots {
  background-image: radial-gradient(circle, rgba(0,0,0,.07) 1px, transparent 1px);
}

/* Centred content */
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 680px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Pill label */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: var(--accent2);
  border: 1px solid rgba(192,132,252,.28);
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(124,92,252,.08);
  margin-bottom: 28px;
}

/* Large Arabic headline */
.hero-title-ar {
  display: block;
  font-family: var(--font-ar);
  font-size: 72px;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(140deg, var(--text) 20%, var(--accent2) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 16px;
}
[data-theme="light"] .hero-title-ar {
  background: linear-gradient(140deg, var(--text) 10%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
}

/* English sub-line */
.hero-title-en {
  font-size: 19px;
  font-weight: 400;
  color: var(--text2);
  line-height: 1.65;
  letter-spacing: .25px;
  margin-bottom: 0;
}

/* Accent divider */
.hero-divider {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  margin: 28px auto;
}

/* CTA row */
.hero-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   DASHBOARD SECTION
   ============================================================ */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 20px;
}

/* ============================================================
   THEME ICON BUTTON
   ============================================================ */
.theme-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  transition: border-color .18s, background .18s;
}
.theme-icon-btn:hover { border-color: var(--accent); background: var(--surface3); }
.theme-icon-img { width: 20px; height: 20px; object-fit: contain; display: block; }

/* ============================================================
   AVATAR DROPDOWN
   ============================================================ */
.avatar-menu { position: relative; }

.avatar-menu .avatar {
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .18s;
}
.avatar-menu .avatar:hover,
.avatar-menu .avatar:focus-visible { border-color: var(--accent); outline: none; }

.avatar-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.avatar-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.avatar-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
}
.avatar-user-name  { font-weight: 600; font-size: 14px; line-height: 1.3; word-break: break-word; }
.avatar-user-email { font-size: 12px; color: var(--text2); word-break: break-all; }

.avatar-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.avatar-dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: 0;
  text-align: start;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.avatar-dropdown-item:hover { background: var(--surface2); color: var(--text); }
.avatar-dropdown-item.danger { color: var(--danger); }
.avatar-dropdown-item.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   ICON BUTTON (generic utility)
   ============================================================ */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  transition: background .18s, color .18s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }

/* ============================================================
   AUTH SHELL
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h1 {
  font-size: 26px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-header p { color: var(--text2); font-size: 13px; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tabs button {
  padding: 9px;
  border-radius: 6px;
  color: var(--text2);
  font-weight: 600;
  font-size: 14px;
  transition: all .15s;
}
.auth-tabs button.active { background: var(--accent); color: #fff; }
.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.role-opt {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}
.role-opt:hover  { border-color: var(--border2); }
.role-opt.active { border-color: var(--accent); background: rgba(124,92,252,.1); }
.role-opt .emoji { font-size: 22px; margin-bottom: 4px; display: block; }
.role-opt .lbl   { font-weight: 600; font-size: 13px; }
.password-rules {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.7;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}
.password-rules .ok { color: var(--success); }

/* ============================================================
   RESPONSIVE OVERRIDES
   ============================================================ */
@media (max-width: 640px) {
  .hero              { min-height: 420px; padding: 64px 20px 56px; }
  .hero-title-ar     { font-size: 44px; }
  .hero-title-en     { font-size: 16px; }
  .hero-eyebrow      { font-size: 10px; letter-spacing: 2.5px; }

  .content           { padding: 20px 16px; }
  .page-header       { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 16px; }
  .page-header > a.btn, .page-header > button.btn { justify-content: center; }

  .auth-shell        { padding: 16px; }
  .auth-card         { padding: 24px 20px; border-radius: var(--radius); }
  .auth-header h1    { font-size: 22px; }
  #lang-label        { display: none; }
  .lang-toggle       { padding: 6px 10px; }
  .switch-label      { display: none; }
}

@media (max-width: 480px) {
  .profile-hero                { flex-direction: column !important; align-items: stretch !important; gap: 14px !important; }
  .profile-hero > .avatar      { align-self: center; }
}
