/**
 * ShreniUP Platform - Interactive Feature Walkthrough Styles
 * Adheres strictly to Sovereign Brand Token Architecture (GEMINI.md Section 11 & Rule 2.D)
 * Sapphire Blue (#2563EB / #1D4ED8) primary theme, responsive bottom drawer on mobile
 */

/* 1. Backdrop Overlay */
#walkthrough-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
  z-index: 1050;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

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

/* 2. Elevated Target Beacon */
.walkthrough-highlight-target {
  position: relative !important;
  z-index: 1055 !important;
  outline: none !important;
  border-radius: 8px;
  background: var(--bg-card, #FFFFFF) !important;
  box-shadow: 0 0 0 3.5px #2563EB, 0 0 24px rgba(37, 99, 235, 0.6) !important;
  animation: walkthrough-beacon-pulse 2s infinite ease-in-out;
  transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  cursor: pointer !important;
}

@keyframes walkthrough-beacon-pulse {
  0% {
    box-shadow: 0 0 0 3px #2563EB, 0 0 16px rgba(37, 99, 235, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px #1D4ED8, 0 0 28px rgba(37, 99, 235, 0.75);
  }
  100% {
    box-shadow: 0 0 0 3px #2563EB, 0 0 16px rgba(37, 99, 235, 0.45);
  }
}

/* High-contrast visibility for nav tabs when highlighted in walkthrough tour */
.nav-tab-btn.walkthrough-highlight-target {
  background: #FFFFFF !important;
  color: #1D4ED8 !important;
  font-weight: 700 !important;
  padding: 0.5rem 1rem !important;
  border-radius: 8px !important;
  border-bottom: none !important;
}

.nav-tab-btn.walkthrough-highlight-target svg {
  stroke: #1D4ED8 !important;
  stroke-width: 2.3 !important;
}

[data-theme="dark"] .nav-tab-btn.walkthrough-highlight-target {
  background: #1E293B !important;
  color: #60A5FA !important;
}

[data-theme="dark"] .nav-tab-btn.walkthrough-highlight-target svg {
  stroke: #60A5FA !important;
}

/* Exam selector group when highlighted */
.exam-selector-group.walkthrough-highlight-target {
  background: #FFFFFF !important;
  border-radius: 8px !important;
  padding: 0.25rem 0.6rem !important;
}

[data-theme="dark"] .exam-selector-group.walkthrough-highlight-target {
  background: #1E293B !important;
}

/* 3. Walkthrough Card (Desktop: Floating Tooltip with Arrow) */
#walkthrough-card {
  position: fixed;
  z-index: 1060;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card, #FFFFFF);
  color: var(--text-main, #0F172A);
  border: 1.5px solid var(--brand-blue, #2563EB);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(37, 99, 235, 0.2);
  padding: 1.15rem 1.25rem;
  display: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  font-family: var(--font-main, 'Inter', -apple-system, sans-serif);
}

#walkthrough-card.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

[data-theme="dark"] #walkthrough-card {
  background: var(--bg-card, #1E293B);
  color: var(--text-main, #F8FAFC);
  border-color: #3B82F6;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
}

/* Card Header */
.walkthrough-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.walkthrough-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand-blue, #2563EB);
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-feature-settings: 'tnum' 1;
}

[data-theme="dark"] .walkthrough-step-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border-color: rgba(96, 165, 250, 0.4);
}

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

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

/* Card Body */
.walkthrough-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 0.45rem 0;
  color: var(--brand-blue, #2563EB);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.walkthrough-description {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted, #475569);
  margin: 0 0 0.85rem 0;
}

[data-theme="dark"] .walkthrough-description {
  color: #94A3B8;
}

/* Action Directive Callout */
.walkthrough-action-prompt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px dashed var(--brand-blue, #2563EB);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-blue, #1D4ED8);
  line-height: 1.4;
}

[data-theme="dark"] .walkthrough-action-prompt {
  background: rgba(37, 99, 235, 0.12);
  border-color: #60A5FA;
  color: #93C5FD;
}

.walkthrough-action-prompt svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--brand-blue, #2563EB);
}

/* Card Navigation Footer */
.walkthrough-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-color, #E2E8F0);
}

[data-theme="dark"] .walkthrough-footer {
  border-top-color: #334155;
}

.walkthrough-dots-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
}

.walkthrough-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: #CBD5E1;
  transition: all 0.2s ease;
}

[data-theme="dark"] .walkthrough-dot {
  background: #475569;
}

.walkthrough-dot.active {
  width: 18px;
  background: var(--brand-blue, #2563EB);
}

.walkthrough-nav-btns {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

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

.btn-walkthrough-prev:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.08);
}

.btn-walkthrough-prev:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.btn-walkthrough-next:hover {
  background: #1D4ED8;
  border-color: #1D4ED8;
}

/* 4. Header Product Tour Trigger Button */
.btn-tour-trigger {
  background: var(--bg-card, #FFFFFF);
  color: var(--brand-blue, #2563EB);
  border: 1px solid var(--brand-blue, #2563EB);
  font-weight: 600;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
}

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

[data-theme="dark"] .btn-tour-trigger {
  color: #60A5FA;
  border-color: #60A5FA;
}

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

/* 5. Mobile Responsive Bottom Sheet Drawer (<= 768px) */
@media (max-width: 768px) {
  #walkthrough-card {
    position: fixed !important;
    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: 1rem 1.15rem !important;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.25) !important;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  }

  #walkthrough-card.active {
    transform: translateY(0) !important;
  }

  .btn-tour-trigger span {
    display: none;
  }

  .btn-tour-trigger {
    padding: 0.42rem;
  }
}
