/**
 * Guided Tour Styles — Enhanced Floating Tooltips
 * Dark navy + amber/gold theme, distinct from the white app
 */

/* ===== Settings Modal during Tour ===== */
.settings-modal-overlay--tour {
  z-index: 9998 !important;
}

/* ===== Tour Color Variables ===== */
:root {
  --tour-bg-start: #1e3a5f;
  --tour-bg-end: #1a2744;
  --tour-text: #ffffff;
  --tour-text-secondary: #cbd5e1;
  --tour-accent: #f59e0b;
  --tour-accent-light: #fbbf24;
  --tour-border: rgba(251, 191, 36, 0.6);
  --tour-shadow: 0 12px 48px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
  --tour-glow: 0 0 20px rgba(245, 158, 11, 0.3), 0 0 60px rgba(245, 158, 11, 0.1);
}

/* ===== Keyframe Animations ===== */

/* Entrance: scale + fade + bounce overshoot */
@keyframes tourEnter {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(8px);
  }
  60% {
    opacity: 1;
    transform: scale(1.04) translateY(-2px);
  }
  80% {
    transform: scale(0.98) translateY(1px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Exit: fast fade */
@keyframes tourExit {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9) translateY(4px); }
}

/* Idle: subtle floating breath */
@keyframes tourFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Target: bright orange pulsing ring — bold & fast */
@keyframes tourPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.8), inset 0 0 0 2px rgba(255, 140, 0, 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(255, 140, 0, 0), inset 0 0 0 2px rgba(255, 140, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 140, 0, 0), inset 0 0 0 0 rgba(255, 140, 0, 0); }
}

/* Help button attention pulse */
@keyframes tourHelpPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 4px 24px rgba(245, 158, 11, 0.7), 0 0 40px rgba(245, 158, 11, 0.25); }
}

/* Progress bar fill */
@keyframes tourProgressFill {
  from { width: 0; }
}

/* ===== Spotlight (cutout around target) ===== */
.tour-spotlight {
  position: fixed;
  z-index: 9999;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  border: 3px solid #ff8c00;
  pointer-events: none;
  transition: top 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  animation: tourPulse 1s infinite;
}

/* ===== Tooltip ===== */
.tour-tooltip {
  position: fixed;
  z-index: 10000;
  background: linear-gradient(135deg, var(--tour-bg-start) 0%, var(--tour-bg-end) 100%);
  border: 2px solid var(--tour-border);
  border-radius: 16px;
  padding: 24px 28px 20px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: var(--tour-shadow), var(--tour-glow);
  color: var(--tour-text);
  font-family: 'Inter', Arial, sans-serif;
  animation: tourEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: auto;
}

.tour-tooltip.is-exiting {
  animation: tourExit 0.2s ease forwards;
}

.tour-tooltip.is-idle {
  animation: tourFloat 3s ease-in-out infinite;
}

/* ===== Tooltip Text ===== */
.tour-text-he {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  margin-bottom: 6px;
}

.tour-text-en {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
  color: var(--tour-text-secondary);
  font-style: italic;
}

/* ===== Interaction Hint ===== */
.tour-hint {
  font-size: 15px;
  opacity: 0.65;
  margin-top: 6px;
  font-style: italic;
}

/* ===== Progress Bar ===== */
.tour-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
}

.tour-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.tour-progress-fill {
  height: 100%;
  background: var(--tour-accent);
  border-radius: 3px;
  transition: width 0.35s ease;
}

.tour-progress-text {
  font-size: 13px;
  color: var(--tour-text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===== Navigation Buttons ===== */
.tour-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: stretch;
  margin-top: 8px;
}

.tour-btn {
  padding: 8px 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  line-height: 1.2;
  text-align: center;
}

.tour-btn .lang-he,
.tour-btn .lang-en,
.tour-btn .lang-sep {
  display: inline !important;
}

.tour-btn br {
  display: none;
}

.tour-btn br + .lang-en::before {
  content: " | ";
  opacity: 0.5;
}

body[data-lang="en"] .tour-btn br + .lang-en::before,
body[data-lang="he"] .tour-btn br + .lang-en::before {
  content: none;
}

.tour-btn .lang-en {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.7;
}

.tour-btn .lang-sep {
  opacity: 0.5;
}

.tour-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.tour-btn:active {
  transform: scale(0.97);
}

.tour-btn--primary {
  background: var(--tour-accent);
  border-color: var(--tour-accent);
  color: #1a1a2e;
}

.tour-btn--primary:hover {
  background: var(--tour-accent-light);
  border-color: var(--tour-accent-light);
}

.tour-btn[disabled] {
  opacity: 0.3;
  cursor: default;
}

.tour-btn--skip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--tour-text-secondary);
  font-weight: 500;
}

.tour-btn--skip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* ===== Arrow (rotated square) ===== */
.tour-arrow {
  position: absolute;
  width: 20px;
  height: 20px;
  z-index: 10000;
  pointer-events: none;
}

.tour-arrow::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--tour-bg-start);
  border: 2px solid var(--tour-border);
  transform: rotate(45deg);
}

/* Arrow pointing UP (tooltip below target) */
.tour-arrow[data-placement="bottom"]::before {
  top: 0;
  border-right: none;
  border-bottom: none;
}

/* Arrow pointing DOWN (tooltip above target) */
.tour-arrow[data-placement="top"]::before {
  bottom: 0;
  border-left: none;
  border-top: none;
}

/* Arrow pointing RIGHT (tooltip left of target) */
.tour-arrow[data-placement="left"]::before {
  right: 0;
  border-left: none;
  border-bottom: none;
}

/* Arrow pointing LEFT (tooltip right of target) */
.tour-arrow[data-placement="right"]::before {
  left: 0;
  border-right: none;
  border-top: none;
}

/* ===== Target Highlight ===== */
.tour-target-highlight {
  position: relative;
  z-index: 9999 !important;
  border-radius: 6px;
}

/* Help button now uses .header-icon-btn styles (inline in header) */
#tourHelpBtn {
  animation: none;
}

/* ===== Welcome Modal ===== */
.tour-welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tour-welcome-box {
  background: linear-gradient(135deg, var(--tour-bg-start) 0%, var(--tour-bg-end) 100%);
  border: 2px solid var(--tour-border);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  color: #fff;
  box-shadow: var(--tour-shadow), var(--tour-glow);
  animation: tourEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.tour-welcome-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.tour-welcome-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}

.tour-welcome-subtitle {
  font-size: 18px;
  color: var(--tour-text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.tour-welcome-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Language-aware text sizing ===== */
/* English-only mode: promote English text to primary style */
body[data-lang="en"] .tour-text-en {
  font-size: 18px;
  font-weight: 600;
  color: var(--tour-text);
  font-style: normal;
}

/* English-only mode: welcome subtitle */
body[data-lang="en"] .tour-welcome-subtitle .lang-en {
  color: #fff !important;
  font-size: 18px;
}

/* English-only mode: welcome title */
body[data-lang="en"] .tour-welcome-title .lang-en {
  font-size: 26px !important;
}

/* ===== Print: hide tour ===== */
@media print {
  .tour-spotlight,
  .tour-tooltip,
  .tour-welcome-overlay,
  #tourHelpBtn {
    display: none !important;
  }
}
