/* ══════════════════════════════════════════════════════════
   EB SMART — Shared Design System
   Higginbotham V3 Style Guide (Blue-Primary Accent)
   ══════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
  /* Surfaces — navy-tinted dark palette */
  --black: #040f1a;
  --card: #0b1726;
  --card-hover: #101e30;

  /* Higginbotham brand tokens */
  --hb-navy: #0A3255;
  --hb-light: #AAD7F5;
  --hb-steel: #6b82a0;

  /* Accent */
  --accent: #5596E1;
  --accent-hover: #4888D4;
  --accent-soft: rgba(85, 150, 225, 0.12);
  --accent-softer: rgba(85, 150, 225, 0.06);
  --accent-glow: 0 6px 24px rgba(85, 150, 225, 0.30);

  /* Text — neutral white-opacity grays (WCAG AA compliant) */
  --white: #f2f4f7;
  --gray-1: rgba(255, 255, 255, 0.85);
  --gray-2: #94a3b8;
  --gray-3: rgba(255, 255, 255, 0.50);
  --gray-4: rgba(255, 255, 255, 0.28);
  --gray-5: rgba(255, 255, 255, 0.07);

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  /* Input surfaces — distinct from parent card */
  --input: rgba(255, 255, 255, 0.03);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Radii */
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 100px;

  /* Layout */
  --max-w: 1120px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Semantic status colors */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --error: #f87171;
  --error-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
}

/* ── Global Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

::selection { background: rgba(85, 150, 225, 0.3); color: #fff; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--hb-steel); border-radius: 3px; }

body {
  font-family: var(--font);
  background: linear-gradient(170deg, #020810 0%, #040f1a 35%, #071828 65%, #0a1e35 100%);
  background-attachment: fixed;
  color: var(--gray-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Glass Morphism — for floating/overlay elements ── */
.glass { background: rgba(11, 23, 38, 0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
.glass-strong { background: rgba(11, 23, 38, 0.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--border-hover); }

/* ── Header (glass morphism) ── */
.header {
  background: rgba(11, 23, 38, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.15)) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6)) drop-shadow(1px 0 0 rgba(0, 0, 0, 0.25)) drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.25));
}

.header-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.02em;
}

.header-sub {
  font-size: 11px;
  color: var(--gray-3);
  letter-spacing: 0.01em;
}

/* ── Navigation ── */
.nav-toggle {
  display: flex;
  gap: 4px;
  margin-left: 20px;
}

.nav-tab {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 450;
  color: var(--gray-2);
  text-decoration: none;
  transition: all 0.25s var(--ease);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--white);
  background: var(--gray-5);
}

.nav-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 550;
}

/* ── Header Right ── */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── User Badge ── */
.user-badge {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 5px 14px;
  font-size: 13px;
  color: var(--gray-3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--gray-3);
  cursor: pointer;
  font-size: 14px;
  margin-left: 4px;
  padding: 2px;
  transition: color 0.25s var(--ease);
}

.logout-btn:hover { color: var(--error); }

/* ── Report Issue Button (legacy — hidden, replaced by help dropdown) ── */
.report-btn { display: none; }

/* ── Header Icon Buttons (Help ? + User Account) ── */
.help-btn, .user-icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.25s var(--ease);
  background: transparent; flex-shrink: 0;
}

.help-btn {
  color: var(--accent); font-size: 14px; font-weight: 700;
  font-family: var(--font);
  border-color: rgba(85, 150, 225, 0.25);
}
.help-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.user-icon-btn { color: var(--gray-3); padding: 0; }
.user-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.user-icon-btn:hover { color: var(--white); border-color: var(--border-hover); background: var(--gray-5); }

/* ── Help Dropdown ── */
.help-dropdown, .user-panel {
  display: none; position: absolute; top: calc(100% + 8px);
  background: rgba(11, 23, 38, 0.95);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-hover);
  border-radius: var(--r); z-index: 150;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.15s var(--ease);
}
.help-dropdown.open, .user-panel.open { display: block; }

.help-dropdown { right: 36px; min-width: 170px; padding: 6px; }

.help-item {
  display: flex; width: 100%; text-align: left; align-items: center; gap: 8px;
  background: none; border: none; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--gray-2); cursor: pointer;
  font-family: var(--font); transition: all 0.15s var(--ease);
}
.help-item:hover { background: var(--gray-5); color: var(--white); }
.help-item svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

/* ── User Panel Dropdown ── */
.user-panel { right: 0; width: 260px; padding: 16px; }

.up-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--border); }
.up-row:last-of-type { border-bottom: none; }
.up-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-3); font-weight: 500; }
.up-value { font-size: 13px; color: var(--gray-1); font-weight: 500; text-align: right; word-break: break-all; }

.up-logout {
  display: block; width: 100%; margin-top: 12px;
  padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 550;
  background: transparent; border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--error); cursor: pointer; font-family: var(--font);
  transition: all 0.25s var(--ease); text-align: center;
}
.up-logout:hover { background: var(--error-soft); border-color: rgba(248, 113, 113, 0.4); }

/* ── Report Issue Modal (glass morphism — floating overlay) ── */
.report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.report-modal {
  background: rgba(11, 23, 38, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-hover);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 440px;
  max-width: 90vw;
}

.report-modal h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  letter-spacing: -0.01em;
}

.report-modal h3 svg { width: 18px; height: 18px; fill: var(--warning); }

.report-modal .rdesc {
  font-size: 13px;
  color: var(--gray-3);
  margin-bottom: 18px;
  line-height: 1.6;
}

.report-modal label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-3);
  display: block;
  margin-bottom: 6px;
}

.report-modal select,
.report-modal textarea {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--white);
  outline: none;
  font-family: var(--font);
  margin-bottom: 14px;
  transition: border-color 0.25s var(--ease);
}

.report-modal select:focus,
.report-modal textarea:focus { border-color: var(--accent); }

.report-modal textarea { resize: vertical; min-height: 72px; }
.report-modal textarea::placeholder { color: var(--gray-4); }
.report-modal select option { background: var(--card); }

.report-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.report-actions button {
  padding: 10px 22px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  font-family: var(--font);
  border: none;
  transition: all 0.35s var(--ease);
}

.rbtn-cancel {
  background: transparent;
  color: var(--gray-2);
  border: 1px solid var(--border);
}

.rbtn-cancel:hover {
  color: var(--white);
  border-color: var(--border-hover);
  background: var(--gray-5);
}

.rbtn-submit {
  background: var(--accent);
  color: #fff;
}

.rbtn-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--accent-glow);
}

/* ── Alert Messages ── */
.ralert {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 12px;
  line-height: 1.5;
  display: none;
}

.ralert.error {
  display: block;
  background: var(--error-soft);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--error);
}

.ralert.success {
  display: block;
  background: var(--success-soft);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--success);
}

/* ── Tour Help Button — hidden (moved to header help dropdown) ── */
.tour-help-btn { display: none; }

/* ── TourGuide.js Dark Theme Overrides ── */
.tg-dialog {
  background: rgba(11, 23, 38, 0.95) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid var(--border-hover) !important;
  color: var(--gray-2) !important;
  font-family: var(--font) !important;
  border-radius: var(--r) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
}

.tg-dialog-title {
  color: var(--white) !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  letter-spacing: -0.01em !important;
}

.tg-dialog-body {
  color: var(--gray-2) !important;
  line-height: 1.6 !important;
  font-size: 13px !important;
}

.tg-dialog-body p { margin: 0 0 8px; }
.tg-dialog-body p:last-child { margin-bottom: 0; }

.tg-dialog-btn {
  border-radius: var(--r-pill) !important;
  font-family: var(--font) !important;
  font-weight: 550 !important;
  font-size: 13px !important;
  padding: 8px 18px !important;
  transition: all 0.2s var(--ease) !important;
}

.tg-dialog-btn.tg-dialog-btn-next,
.tg-dialog-btn.tg-dialog-btn-complete {
  background: var(--accent) !important;
  color: #fff !important;
  border: none !important;
}

.tg-dialog-btn.tg-dialog-btn-next:hover,
.tg-dialog-btn.tg-dialog-btn-complete:hover {
  background: var(--accent-hover) !important;
}

.tg-dialog-btn.tg-dialog-btn-prev {
  background: transparent !important;
  border: 1px solid rgba(85, 150, 225, 0.25) !important;
  color: var(--accent) !important;
}

.tg-dialog-btn.tg-dialog-btn-prev:hover {
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
  color: var(--white) !important;
}

.tg-dialog .tg-step-dots button {
  background: var(--gray-4) !important;
}

.tg-dialog .tg-step-dots button.active {
  background: var(--accent) !important;
}

.tg-dialog .tg-dialog-close-btn {
  color: var(--gray-3) !important;
}

.tg-dialog .tg-dialog-close-btn:hover {
  color: var(--white) !important;
}

.tg-dialog .tg-step-progress {
  color: var(--gray-3) !important;
  font-size: 11px !important;
}

/* Backdrop — lighter so users can see the page context */
[class*="tg-backdrop"] {
  background: rgba(2, 8, 16, 0.55) !important;
}

/* Highlight ring around the active target element */
.tg-active-target {
  outline: 2px solid var(--accent) !important;
  outline-offset: 4px !important;
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(85, 150, 225, 0.15), 0 0 24px rgba(85, 150, 225, 0.10) !important;
  position: relative;
  z-index: 1000 !important;
}

/* ── Hamburger Button ── */
.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
  flex-direction: column;
  gap: 3px;
  margin-left: 12px;
  transition: border-color 0.25s var(--ease);
}

.hamburger:hover { border-color: var(--border-hover); }

.hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--gray-2);
  border-radius: 1px;
  transition: all 0.25s var(--ease);
}

/* ── Starfield ── */
.starfield { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.starfield canvas { display: block; width: 100%; height: 100%; }
.starfield-glow {
  position: absolute; bottom: -30%; left: 50%; transform: translateX(-50%);
  width: 80vw; height: 50vh; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(55, 130, 210, 0.10) 0%, rgba(30, 80, 160, 0.04) 40%, transparent 70%);
  filter: blur(60px);
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .header-sub { display: none; }

  .nav-toggle {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(11, 23, 38, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-hover);
    flex-direction: column;
    padding: 8px 12px;
    gap: 2px;
    margin-left: 0;
    border-radius: 0;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }

  .nav-toggle.open { display: flex; }

  .nav-tab {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 10px;
  }

  .header { position: relative; }
  .header-right { gap: 6px; }
  .user-badge { display: none; }

  /* Report modal — hide conversation context on mobile */
  .context-label, .context-preview { display: none; }
}
