/* ==========================================================================
   Guide — tours, welcome, Learning center, tips, Ask panel.
   Al-Nokhba brand: actions and highlights use --brand (bronze in light,
   gold in dark), panels --surface-raised, lines --line. Arabic text uses
   the brand's IBM Plex Sans Arabic (brand/fonts).
   ========================================================================== */

:root {
  --guide-btn: var(--brand);
  --guide-btn-hover: var(--brand-hover);
  --guide-hi: var(--brand);
  --guide-border: var(--line);
  --guide-surface: var(--surface-raised);
  --guide-surface-solid: var(--surface-raised);
  --guide-soft: var(--brand-soft);
  --guide-font: var(--font-sans);
  --guide-z: 2147483000;
}

.guide-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.guide-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 16px;
  border: 1px solid var(--guide-border); border-radius: var(--radius-md);
  background: transparent; color: var(--text);
  font: 600 14px/1.2 var(--guide-font); cursor: pointer;
}
.guide-btn:hover:not(:disabled) { border-color: var(--guide-hi); background: var(--guide-soft); }
.guide-btn:focus-visible { outline: 2px solid var(--guide-hi); outline-offset: 2px; }
.guide-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.guide-btn-primary { border-color: var(--guide-btn); background: var(--guide-btn); color: var(--on-brand); }
.guide-btn-primary:hover:not(:disabled) { border-color: var(--guide-btn-hover); background: var(--guide-btn-hover); }
.guide-btn-ghost { border-color: transparent; color: var(--text-2); }
.guide-btn-sm { min-height: 44px; padding: 0 12px; font-size: 13px; }
.guide-btn-icon { padding: 0; width: 44px; font-size: 20px; line-height: 1; }

/* ---------- tour: spotlight + bubble ---------- */
.guide-layer { position: fixed; inset: 0; z-index: var(--guide-z); pointer-events: none; }
.guide-layer[hidden] { display: none; }
.guide-spot {
  position: fixed; border: 2px solid var(--guide-hi); border-radius: 10px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 28%, transparent), 0 0 24px 6px color-mix(in srgb, var(--brand) 35%, transparent), 0 0 0 9999px rgba(7, 8, 10, 0.72);
  transition: left 180ms ease, top 180ms ease, width 180ms ease, height 180ms ease;
  animation: guide-glow 1.8s ease-in-out infinite;
  pointer-events: none;
}
.guide-spot[hidden] { display: none; }
@keyframes guide-glow {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 28%, transparent), 0 0 24px 6px color-mix(in srgb, var(--brand) 35%, transparent), 0 0 0 9999px rgba(7, 8, 10, 0.72); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 18%, transparent), 0 0 30px 10px color-mix(in srgb, var(--brand) 25%, transparent), 0 0 0 9999px rgba(7, 8, 10, 0.72); }
}
.guide-bubble {
  position: fixed; width: min(360px, calc(100vw - 24px)); padding: 16px 18px 14px;
  border: 1px solid var(--guide-border); border-radius: var(--radius-xl);
  background: var(--guide-surface); color: var(--text);
  box-shadow: var(--shadow-popover); font: 14px/1.55 var(--guide-font);
  pointer-events: auto;
}
.guide-bubble:focus { outline: none; }
.guide-bubble:focus-visible { outline: 2px solid var(--guide-hi); outline-offset: 2px; }
.guide-bubble-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.guide-kicker { color: var(--guide-hi); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.guide-dots { display: inline-flex; gap: 5px; }
.guide-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.guide-dot.is-past { background: color-mix(in srgb, var(--brand) 55%, var(--line)); }
.guide-dot.is-current { width: 18px; border-radius: 4px; background: var(--guide-hi); }
.guide-bubble-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; line-height: 1.35; }
.guide-bubble-body { margin: 0; color: var(--text-2); }
.guide-try { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--guide-hi); border-radius: var(--radius-md); background: var(--brand-soft); color: var(--text); }
.guide-try-label { color: var(--guide-hi); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.guide-try.is-done { border-style: solid; border-color: var(--success); background: var(--success-soft); }
.guide-try.is-done .guide-try-label { color: var(--success); }
.guide-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.guide-spacer { flex: 1; }
.guide-bubble[lang="ar"] .guide-try-label { text-transform: none; letter-spacing: 0; }

/* ---------- paused chip + notices ---------- */
.guide-chip, .guide-notice {
  position: fixed; inset-inline-start: 16px; bottom: 16px; z-index: var(--guide-z);
  display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100vw - 32px));
  padding: 6px 6px 6px 14px; border: 1px solid var(--guide-border); border-radius: var(--radius-lg);
  background: var(--guide-surface); color: var(--text); box-shadow: var(--shadow-popover);
  font: 13px/1.4 var(--guide-font);
}
.guide-notice { padding: 12px 16px; }
.guide-notice[hidden] { display: none; }
.guide-chip-text { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .guide-spot { transition: none; animation: none; }
}
.guide-layer.is-reduced .guide-spot { transition: none; animation: none; }

/* ---------- header pill + floating button ---------- */
.guide-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px 0 10px;
  border: 1px solid var(--guide-border); border-radius: var(--radius-pill);
  background: var(--guide-soft); color: var(--brand); font: 600 13px/1 var(--guide-font); cursor: pointer;
}
.guide-pill:hover { border-color: var(--guide-hi); background: var(--surface-sunken); }
.guide-pill:focus-visible { outline: 2px solid var(--guide-hi); outline-offset: 2px; }
.guide-pill-icon { display: inline-flex; color: var(--guide-hi); }
.guide-pill-icon svg { width: 16px; height: 16px; }
/* 44px hit area without changing the header's height */
.guide-pill { position: relative; }
.guide-pill::after { content: ""; position: absolute; inset: -6px -2px; }

.guide-fab {
  position: fixed; inset-inline-end: 24px; bottom: 24px; z-index: 900;
  display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 20px 0 16px;
  border: 1px solid var(--guide-btn); border-radius: var(--radius-pill);
  background: var(--guide-btn); color: var(--on-brand); font: 600 14px/1 var(--guide-font);
  box-shadow: var(--shadow-md); cursor: pointer;
}
.guide-fab:hover { background: var(--guide-btn-hover); }
.guide-fab:focus-visible { outline: 2px solid var(--guide-hi); outline-offset: 3px; }
.guide-fab[hidden] { display: none; }
.guide-fab-icon { display: inline-flex; }

/* ---------- welcome ---------- */
.guide-welcome-layer { position: fixed; inset: 0; z-index: calc(var(--guide-z) - 10); }
.guide-backdrop { position: absolute; inset: 0; background: rgba(7, 8, 10, 0.62); }
.guide-welcome {
  position: absolute; inset-inline-end: 24px; bottom: 24px; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  padding: 20px; border: 1px solid var(--guide-border); border-radius: var(--radius-xl);
  background: var(--guide-surface); color: var(--text); box-shadow: var(--shadow-dialog); font: 14px/1.5 var(--guide-font);
}
.guide-welcome-brand { display: block; height: 28px; width: auto; margin: 0 0 14px; }
.guide-welcome-head { display: flex; gap: 12px; align-items: flex-start; }
.guide-avatar { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--guide-btn); color: var(--on-brand); }
.guide-welcome-title { margin: 2px 0 2px; font-size: 17px; font-weight: 700; }
.guide-welcome-sub { margin: 0; color: var(--text-2); }
.guide-welcome-ask { margin: 16px 0 8px; font-weight: 600; }
.guide-paths { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.guide-path {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-raised);
  color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.guide-path:hover, .guide-path:focus-visible { border-color: var(--guide-hi); background: var(--guide-soft); outline: none; }
.guide-path-icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; }
.guide-path-icon.is-record { background: var(--danger-soft); color: var(--danger); }
.guide-path-icon.is-edit { background: var(--info-soft); color: var(--info); }
.guide-path-icon.is-scorm { background: var(--purple-soft-bg); color: var(--purple); }
.guide-path-icon.is-pdf { background: var(--danger-soft); color: var(--danger); }
.guide-path-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.guide-path-title { font-weight: 600; }
.guide-path-sub { color: var(--muted); font-size: 12.5px; }
.guide-path-time { flex: 0 0 auto; padding: 3px 8px; border: 1px solid var(--guide-border); border-radius: var(--radius-pill); color: var(--guide-hi); font: 500 12px/1.2 var(--font-mono); }
.guide-welcome-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.guide-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text-2); cursor: pointer; }
.guide-check input { width: 18px; height: 18px; accent-color: var(--guide-btn); }

/* ---------- Learning center ---------- */
.guide-center-layer { position: fixed; inset: 0; z-index: calc(var(--guide-z) - 20); display: flex; align-items: center; justify-content: center; padding: 24px; }
.guide-center {
  position: relative; display: flex; flex-direction: column; width: min(1080px, 100%); max-height: calc(100vh - 48px);
  border: 1px solid var(--guide-border); border-radius: var(--radius-xl); background: var(--guide-surface);
  color: var(--text); box-shadow: var(--shadow-dialog); font: 14px/1.5 var(--guide-font);
}
.guide-center:focus { outline: none; }
.guide-center-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.guide-center-titles { flex: 1; min-width: 0; }
.guide-center-title { margin: 0; font-size: 20px; font-weight: 700; }
.guide-center-sub { margin: 0; color: var(--text-2); }
.guide-center-body { overflow: auto; padding: 0 20px 20px; }
.guide-search { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; margin-bottom: 18px; border: 1px solid var(--guide-border); border-radius: var(--radius-lg); background: var(--surface-sunken); }
.guide-search:focus-within { border-color: var(--guide-hi); }
.guide-search-icon { display: inline-flex; color: var(--muted); }
.guide-search input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.guide-center-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .guide-center-grid { grid-template-columns: 1fr; } }
.guide-center-side { display: grid; gap: 14px; }
.guide-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.guide-card h3, .guide-tours-section h3 { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.guide-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.guide-card-head h3 { margin: 0; }
.guide-mono { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.guide-progress { height: 6px; margin: 0 0 10px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; }
.guide-progress-fill { display: block; height: 100%; background: var(--guide-hi); border-radius: 3px; }
.guide-ck-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.guide-ck { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.guide-ck-mark { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 1.5px solid var(--guide-border); border-radius: 50%; }
.guide-ck.is-done .guide-ck-mark { border-color: var(--success); background: var(--success); color: var(--ink-inverse); }
.guide-ck-text { flex: 1; }
.guide-ck.is-done .guide-ck-text { color: var(--muted); text-decoration: line-through; }
.guide-filter { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-pill); }
.guide-filter-btn { min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-2); font: 600 13px/1 var(--guide-font); cursor: pointer; position: relative; }
.guide-filter-btn::after { content: ""; position: absolute; inset: -4px 0; }
.guide-filter-btn[aria-checked="true"] { background: var(--guide-btn); color: var(--on-brand); }
.guide-filter-btn:focus-visible { outline: 2px solid var(--guide-hi); outline-offset: 1px; }
.guide-tours { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.guide-empty { display: block; color: var(--muted); }
.guide-tour { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.guide-tour.is-progress { border-color: var(--guide-border); }
.guide-tour-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.guide-chip-sec { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; }
.guide-chip-sec svg { width: 13px; height: 13px; }
.guide-chip-sec.is-recorder { background: var(--danger-soft); color: var(--danger); }
.guide-chip-sec.is-editor { background: var(--info-soft); color: var(--info); }
.guide-chip-sec.is-scorm { background: var(--purple-soft-bg); color: var(--purple); }
.guide-chip-sec.is-pdf { background: var(--danger-soft); color: var(--danger); }
.guide-chip-sec.is-live { background: var(--danger-soft); color: var(--danger); }
.guide-chip-sec.is-convert { background: var(--success-soft); color: var(--success); }
.guide-tour-status { font-size: 12px; color: var(--muted); }
.guide-tour-status.is-done { color: var(--success); }
.guide-tour-status.is-progress { color: var(--guide-hi); }
.guide-tour-title { margin: 2px 0 0; font-size: 15px; font-weight: 700; }
.guide-tour-meta { margin: 0 0 6px; }
.guide-tour .guide-btn { align-self: flex-start; margin-top: auto; }
.guide-popular { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.guide-link { display: block; width: 100%; min-height: 44px; padding: 8px 6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--brand); font: inherit; text-align: start; cursor: pointer; }
.guide-link:hover { background: var(--guide-soft); color: var(--brand-hover); }
.guide-link:focus-visible { outline: 2px solid var(--guide-hi); }
.guide-label { margin: 10px 0 6px; font-weight: 600; font-size: 13px; }
.guide-hint { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.guide-seg { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.guide-seg button { min-height: 38px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font: 600 13px/1 var(--guide-font); cursor: pointer; position: relative; }
.guide-seg button::after { content: ""; position: absolute; inset: -3px 0; }
.guide-seg button[aria-checked="true"] { background: var(--guide-btn); color: var(--on-brand); }
.guide-seg button:focus-visible { outline: 2px solid var(--guide-hi); }
.guide-btn-danger-ghost { margin-top: 14px; border-color: transparent; color: var(--danger-text); }
.guide-btn-danger-ghost:hover:not(:disabled) { border-color: var(--danger-border); background: var(--danger-soft-bg); }
.guide-btn-danger { border-color: var(--danger); background: var(--danger); color: var(--ink-inverse); }
.guide-confirm { margin-top: 14px; padding: 12px; border: 1px solid var(--danger-border); border-radius: var(--radius-md); background: var(--danger-soft-bg); }
.guide-confirm p { margin: 0; }
.guide-settings .guide-check { align-items: flex-start; }
.guide-settings .guide-check input { margin-top: 3px; }

/* ---------- first-time tips ---------- */
.guide-tip {
  position: fixed; z-index: calc(var(--guide-z) - 30); width: min(320px, calc(100vw - 24px)); padding: 10px 12px 12px 14px;
  border: 1px solid var(--guide-border); border-radius: var(--radius-lg); background: var(--guide-surface);
  color: var(--text); box-shadow: var(--shadow-popover); font: 13.5px/1.5 var(--guide-font);
}
.guide-tip-head { display: flex; align-items: center; gap: 8px; }
.guide-tip-icon { display: inline-flex; color: var(--guide-hi); }
.guide-tip-label { flex: 1; color: var(--guide-hi); font-size: 12px; font-weight: 700; }
.guide-tip-x { width: 36px; min-width: 36px; min-height: 36px; margin: -4px -6px -4px 0; font-size: 16px; }
.guide-tip-x::after { content: ""; position: absolute; inset: -4px; }
.guide-tip-x { position: relative; }
.guide-tip-text { margin: 4px 0 0; color: var(--text-2); }
.guide-tip .guide-actions { margin-top: 10px; }

/* Arabic Guide text: the brand's Arabic face; never letter-spaced or uppercased */
.guide-bubble[lang="ar"], .guide-welcome[lang="ar"], .guide-center[lang="ar"], .guide-tip[lang="ar"],
.guide-chip[lang="ar"], .guide-notice[dir="rtl"] { font-family: var(--font-arabic); letter-spacing: normal; }
