/**
 * ShreniUP Platform - Interactive Help Hub & Feature Guide Styles
 * Adheres strictly to Sovereign Brand Token Architecture (GEMINI.md Rule 2.D & Rule 11.C)
 * Sapphire Blue (#2563EB / #1D4ED8) primary theme, responsive slide-over drawer on desktop,
 * docked slide-up bottom drawer on mobile (<= 768px), auto-hidden during live exam arena.
 */

/* 1. Floating Help Hub Trigger Button (Bottom-Right) */
#btn-floating-help-hub {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1040;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-blue, #2563EB);
  color: #FFFFFF;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  padding: 0.65rem 1.15rem;
  font-family: var(--font-main, 'Inter', -apple-system, sans-serif);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35), 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background-color 0.15s ease;
  user-select: none;
}

#btn-floating-help-hub:hover {
  background: #1D4ED8;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.45), 0 4px 8px rgba(0, 0, 0, 0.15);
}

#btn-floating-help-hub:active {
  transform: translateY(0);
}

#btn-floating-help-hub svg {
  flex-shrink: 0;
  stroke: #FFFFFF;
}

/* Auto-hide Help Hub trigger during active live exam sessions per GEMINI.md Rule 7.B */
body.arena-active #btn-floating-help-hub {
  display: none !important;
}

/* 2. Backdrop Overlay */
#help-hub-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1060;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#help-hub-backdrop.active {
  display: block;
  opacity: 1;
}

/* 3. Slide-Over Drawer (Desktop: Right Slide-In Panel) */
#help-hub-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-card, #FFFFFF);
  color: var(--text-main, #0F172A);
  border-left: 2px solid var(--brand-blue, #2563EB);
  box-shadow: -10px 0 40px rgba(15, 23, 42, 0.25);
  z-index: 1070;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-main, 'Inter', -apple-system, sans-serif);
}

#help-hub-drawer.active {
  transform: translateX(0);
}

[data-theme="dark"] #help-hub-drawer {
  background: var(--bg-card, #1E293B);
  color: var(--text-main, #F8FAFC);
  border-left-color: #3B82F6;
  box-shadow: -12px 0 45px rgba(0, 0, 0, 0.55);
}

/* Drawer Header */
.help-hub-header {
  padding: 1.25rem 1.35rem 1rem 1.35rem;
  border-bottom: 1px solid var(--border-color, #E2E8F0);
  background: var(--bg-card, #FFFFFF);
  flex-shrink: 0;
}

[data-theme="dark"] .help-hub-header {
  background: var(--bg-card, #1E293B);
  border-bottom-color: #334155;
}

.help-hub-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.help-hub-title-group {
  display: flex;
  align-items: center;
  gap: 9px;
}

.help-hub-title-group svg {
  stroke: var(--brand-blue, #2563EB);
}

.help-hub-title {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--brand-blue, #2563EB);
  letter-spacing: -0.2px;
}

[data-theme="dark"] .help-hub-title {
  color: #60A5FA;
}

.help-hub-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #64748B);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.help-hub-close-btn:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-blue, #2563EB);
}

/* Instant Search Input */
.help-hub-search-box {
  position: relative;
  width: 100%;
  margin-bottom: 0.65rem;
}

.help-hub-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  stroke: var(--brand-blue, #2563EB);
}

.help-hub-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 2.2rem 0.6rem 2.4rem;
  border-radius: 8px;
  border: 1.5px solid var(--border-color, #CBD5E1);
  background: var(--bg-base, #F8FAFC);
  color: var(--text-main, #0F172A);
  font-family: var(--font-main, 'Inter', sans-serif);
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.help-hub-search-input:focus {
  border-color: var(--brand-blue, #2563EB);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

[data-theme="dark"] .help-hub-search-input {
  background: #0F172A;
  border-color: #334155;
  color: #F8FAFC;
}

[data-theme="dark"] .help-hub-search-input:focus {
  border-color: #3B82F6;
  background: #1E293B;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.help-hub-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted, #94A3B8);
  cursor: pointer;
  padding: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.help-hub-search-clear.visible {
  display: flex;
}

.help-hub-search-clear:hover {
  color: var(--brand-blue, #2563EB);
}

/* Category Filter Pills */
.help-hub-category-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.help-category-pill {
  background: transparent;
  color: var(--text-muted, #64748B);
  border: 1px solid var(--border-color, #CBD5E1);
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.help-category-pill:hover {
  background: rgba(37, 99, 235, 0.06);
  border-color: var(--brand-blue, #2563EB);
  color: var(--brand-blue, #2563EB);
}

.help-category-pill.active {
  background: var(--brand-blue, #2563EB);
  color: #FFFFFF;
  border-color: var(--brand-blue, #2563EB);
}

/* Drawer Scrollable Content Body */
.help-hub-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.15rem 1.35rem 2rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Quick Tour Launch Banner Card */
.help-tour-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(29, 78, 216, 0.12) 100%);
  border: 1.5px solid var(--brand-blue, #2563EB);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

[data-theme="dark"] .help-tour-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(29, 78, 216, 0.25) 100%);
  border-color: #3B82F6;
}

.help-tour-banner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--brand-blue, #1D4ED8);
}

[data-theme="dark"] .help-tour-banner-header {
  color: #93C5FD;
}

.help-tour-banner-header svg {
  stroke: var(--brand-blue, #2563EB);
}

.help-tour-banner-desc {
  font-size: 0.82rem;
  color: var(--text-muted, #475569);
  line-height: 1.45;
}

[data-theme="dark"] .help-tour-banner-desc {
  color: #CBD5E1;
}

.btn-launch-tour-from-hub {
  align-self: flex-start;
  background: var(--brand-blue, #2563EB);
  color: #FFFFFF;
  border: 1px solid var(--brand-blue, #2563EB);
  border-radius: 6px;
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-launch-tour-from-hub:hover {
  background: #1D4ED8;
  border-color: #1D4ED8;
}

/* Feature Guide Cards */
.help-section-label {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand-blue, #2563EB);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .help-section-label {
  color: #60A5FA;
}

.help-feature-card {
  background: var(--bg-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-left: 3.5px solid var(--brand-blue, #2563EB);
  border-radius: 10px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all 0.18s ease;
}

.help-feature-card:hover {
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
  border-color: var(--brand-blue, #2563EB);
}

[data-theme="dark"] .help-feature-card {
  background: #1E293B;
  border-color: #334155;
  border-left-color: #3B82F6;
}

[data-theme="dark"] .help-feature-card:hover {
  border-color: #60A5FA;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.help-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.help-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--brand-blue, #2563EB);
  display: flex;
  align-items: center;
  gap: 7px;
}

[data-theme="dark"] .help-card-title {
  color: #60A5FA;
}

.help-card-title svg {
  stroke: var(--brand-blue, #2563EB);
  flex-shrink: 0;
}

.help-card-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand-blue, #2563EB);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  white-space: nowrap;
}

[data-theme="dark"] .help-card-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
  border-color: rgba(96, 165, 250, 0.3);
}

.help-card-desc {
  font-size: 0.81rem;
  line-height: 1.45;
  color: var(--text-muted, #475569);
}

[data-theme="dark"] .help-card-desc {
  color: #94A3B8;
}

.help-card-takeaways {
  list-style: none;
  padding: 0;
  margin: 0.2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.help-card-takeaways li {
  font-size: 0.77rem;
  color: var(--text-main, #334155);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}

[data-theme="dark"] .help-card-takeaways li {
  color: #CBD5E1;
}

.help-card-takeaways li svg {
  stroke: var(--brand-blue, #2563EB);
  flex-shrink: 0;
  margin-top: 2px;
}

.btn-show-in-app {
  align-self: flex-start;
  margin-top: 0.35rem;
  background: transparent;
  color: var(--brand-blue, #2563EB);
  border: 1px solid var(--brand-blue, #2563EB);
  border-radius: 6px;
  padding: 0.32rem 0.75rem;
  font-size: 0.77rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-show-in-app:hover {
  background: rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .btn-show-in-app {
  color: #60A5FA;
  border-color: #60A5FA;
}

[data-theme="dark"] .btn-show-in-app:hover {
  background: rgba(59, 130, 246, 0.12);
}

/* FAQs & Concepts Accordion Card */
.help-faq-card {
  background: var(--bg-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.18s ease;
}

[data-theme="dark"] .help-faq-card {
  background: #1E293B;
  border-color: #334155;
}

.help-faq-trigger {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-main, 'Inter', sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main, #0F172A);
  transition: background 0.15s ease;
}

[data-theme="dark"] .help-faq-trigger {
  color: #F8FAFC;
}

.help-faq-trigger:hover {
  background: rgba(37, 99, 235, 0.04);
}

.help-faq-trigger svg {
  stroke: var(--brand-blue, #2563EB);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.help-faq-card.open .help-faq-trigger svg {
  transform: rotate(180deg);
}

.help-faq-content {
  display: none;
  padding: 0 1rem 0.95rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted, #475569);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .help-faq-content {
  color: #94A3B8;
  border-top-color: rgba(255, 255, 255, 0.05);
}

.help-faq-card.open .help-faq-content {
  display: block;
}

/* Empty Search Results Message */
.help-hub-empty-state {
  display: none;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted, #64748B);
}

.help-hub-empty-state.visible {
  display: block;
}

.help-hub-empty-state svg {
  stroke: var(--brand-blue, #2563EB);
  margin-bottom: 0.65rem;
}

.help-hub-empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main, #0F172A);
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .help-hub-empty-title {
  color: #F8FAFC;
}

/* 4. "Show Me in App" Contextual Spotlight Tooltip */
#help-spotlight-tooltip {
  position: fixed;
  z-index: 1080;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card, #FFFFFF);
  color: var(--text-main, #0F172A);
  border: 2px solid var(--brand-blue, #2563EB);
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.22);
  padding: 1.05rem 1.15rem;
  display: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-family: var(--font-main, 'Inter', -apple-system, sans-serif);
}

#help-spotlight-tooltip.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

[data-theme="dark"] #help-spotlight-tooltip {
  background: #1E293B;
  color: #F8FAFC;
  border-color: #3B82F6;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

.help-spotlight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.help-spotlight-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--brand-blue, #2563EB);
  display: flex;
  align-items: center;
  gap: 7px;
}

[data-theme="dark"] .help-spotlight-title {
  color: #60A5FA;
}

.help-spotlight-desc {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, #475569);
  margin-bottom: 0.85rem;
}

[data-theme="dark"] .help-spotlight-desc {
  color: #94A3B8;
}

.help-spotlight-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.btn-spotlight-back {
  background: transparent;
  color: var(--brand-blue, #2563EB);
  border: 1px solid var(--brand-blue, #2563EB);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-spotlight-back:hover {
  background: rgba(37, 99, 235, 0.08);
}

.btn-spotlight-done {
  background: var(--brand-blue, #2563EB);
  color: #FFFFFF;
  border: 1px solid var(--brand-blue, #2563EB);
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-spotlight-done:hover {
  background: #1D4ED8;
  border-color: #1D4ED8;
}

/* 5. Mobile Responsive Bottom Sheet Drawer (<= 768px) */
@media (max-width: 768px) {
  /* Elevate floating trigger above mobile bottom navigation bar */
  #btn-floating-help-hub {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    padding: 0.55rem 0.95rem;
    font-size: 0.82rem;
  }

  /* Slide up from bottom on mobile instead of sliding from right */
  #help-hub-drawer {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 82vh !important;
    height: 82dvh !important;
    border-left: none !important;
    border-top: 2.5px solid var(--brand-blue, #2563EB) !important;
    border-radius: 18px 18px 0 0 !important;
    transform: translateY(100%);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  #help-hub-drawer.active {
    transform: translateY(0) !important;
  }

  .help-hub-body {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  /* Mobile Spotlight Tooltip: Fixed Bottom Dock */
  #help-spotlight-tooltip {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 16px 16px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-top: 2px solid var(--brand-blue, #2563EB) !important;
    padding-bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.28) !important;
    transform: translateY(100%);
  }

  #help-spotlight-tooltip.active {
    transform: translateY(0) !important;
  }
}
