/* =========================================================
   ADHD Budget Planner - Maya's Guided Tour & Conversational System
   Clean, 100% responsive, zero modal collision, DOM-anchored,
   gentle ADHD guardrails.
   ========================================================= */

/* Ambient tint: crystal clear, zero blur */
.tutorial-mask-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.08);
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tutorial-mask-overlay.active {
  opacity: 1;
}

/* Guardrail when tour is active */
body.tutorial-active .nav-dock .nav-tab,
body.tutorial-active .sidebar-nav .sidebar-link {
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

/* DOM-Anchored Target Spotlight & Beacon */
.tutorial-target-active {
  position: relative !important;
  z-index: 9200 !important;
  outline: 2.5px solid #059669 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px rgba(5, 150, 105, 0.2), 0 8px 24px rgba(0, 0, 0, 0.12) !important;
  animation: targetPulse 2s infinite ease-in-out !important;
}

@keyframes targetPulse {
  0%, 100% { outline-color: #059669; }
  50% { outline-color: #10b981; }
}

/* DOM-Anchored Maya Target Badge (Physically anchored to the element) */
.maya-target-badge {
  position: absolute;
  top: -12px;
  right: -8px;
  background: #059669;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 9210;
  white-space: nowrap;
  animation: badgePop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nav-tab .maya-target-badge,
.sidebar-link .maya-target-badge {
  top: -10px;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes badgePop {
  from { transform: scale(0.7) translateY(4px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Active typing animation */
.typing-active {
  outline: 2px solid #059669 !important;
  outline-offset: 1px !important;
  background-color: #f0fdf4 !important;
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15) !important;
}

/* Tutorial HUD Bar (Always at top, clear exit button) */
.tutorial-hud-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 42px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 9700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tutorial-hud-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.tutorial-hud-exit {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tutorial-hud-exit:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Maya's Compact Companion Chat Bubble (Mobile-First, Safe Above Dock) */
.tutorial-guide-card {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 10px);
  left: 12px;
  right: 12px;
  width: auto;
  max-width: calc(100vw - 24px);
  margin: 0 auto;
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #059669;
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.05);
  z-index: 9600;
  animation: mayaBubblePop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: bottom 0.25s ease, opacity 0.2s ease, transform 0.25s ease;
}

@media (min-width: 768px) and (orientation: landscape) {
  .tutorial-guide-card {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 380px;
    max-width: 420px;
    padding: 16px 18px;
  }
}

@keyframes mayaBubblePop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Guardrail Nudge Shake */
@keyframes mayaNudge {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.tutorial-guide-card.nudge {
  animation: mayaNudge 0.4s ease !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25), 0 16px 36px -8px rgba(0, 0, 0, 0.2) !important;
}

/* Maya Bubble Inner Layout */
.maya-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.maya-bubble-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.maya-bubble-avatar {
  font-size: 20px;
  line-height: 1;
}

.maya-bubble-name {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 5px;
}

.maya-online-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.maya-bubble-step {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 2px 7px;
}

.maya-bubble-message {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 10px;
}

.maya-bubble-message strong {
  color: #0f172a;
}

/* Guardrail Nudge Toast inside Bubble */
.maya-nudge-toast {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  animation: badgePop 0.2s ease forwards;
}

/* Action button inside Maya's bubble */
.maya-bubble-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.maya-bubble-prompt-btn {
  background: #059669;
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
  width: 100%;
}

.maya-bubble-prompt-btn:hover {
  background: #047857;
  transform: translateY(-1px);
}

.maya-bubble-prompt-btn.pulse {
  animation: btnPulse 1.2s infinite ease-in-out;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
}

.maya-bubble-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.btn-bubble-nav {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-bubble-next {
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  color: #059669;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
}

/* =========================================================
   EMBEDDED MODAL GUIDE BANNER (ZERO MODAL OVERLAP)
   Injected cleanly at the top of the modal dialog so Maya
   is part of the form, NEVER floating over inputs!
   ========================================================= */
.maya-modal-guide-banner {
  background: #ecfdf5;
  border: 1.5px solid #059669;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: badgePop 0.2s ease forwards;
}

.maya-modal-guide-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.maya-modal-guide-profile {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #065f46;
}

.maya-modal-guide-msg {
  font-size: 13px;
  color: #1e293b;
  line-height: 1.45;
}

.maya-modal-guide-btn {
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

.maya-modal-guide-btn:hover {
  background: #047857;
}

.maya-modal-guide-btn.pulse {
  animation: btnPulse 1.2s infinite ease-in-out;
}

/* Secondary Tab Side-Pops */
.maya-side-pop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1.5px solid #059669;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 9100;
  animation: mayaBubblePop 0.25s ease forwards;
}

.maya-side-pop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.maya-side-pop-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.maya-side-pop-body {
  font-size: 12.5px;
  color: #334155;
  line-height: 1.45;
  margin-bottom: 8px;
}

.maya-side-pop-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

/* Mobile & Small Screens Responsiveness */
@media (max-width: 640px) {
  .tutorial-guide-card {
    right: 12px !important;
    left: 12px !important;
    bottom: calc(var(--nav-height, 60px) + 12px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    padding: 12px 14px !important;
  }

  .maya-side-pop {
    right: 12px !important;
    left: 12px !important;
    bottom: calc(var(--nav-height, 60px) + 12px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
  }
}
