/* ═══════════════════════════════════════════════════════════
   LYDIA INTERACTIVE EXPERIENCE — components.css
   Buttons, progress bars, modals, reusable elements
═══════════════════════════════════════════════════════════ */

/* ╔══════════════════════════════════╗
   ║          BUTTONS                 ║
   ╚══════════════════════════════════╝ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-arabic);
  font-size: var(--fs-md);
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-full);
  padding: 14px 32px;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--t-bounce),
    box-shadow var(--t-normal),
    opacity var(--t-fast),
    background var(--t-normal);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--t-fast);
  border-radius: inherit;
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.06);
}

.btn:active {
  transform: scale(0.95) !important;
}

/* ── Primary (Pink Gradient) ────────────────────────────── */
.btn--primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
  color: #fff;
  box-shadow: var(--glow-pink), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn--primary:hover {
  box-shadow: var(--glow-pink), 0 6px 24px rgba(255,45,120,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-2px) scale(1.02);
}

/* ── Secondary (Outlined Pink) ──────────────────────────── */
.btn--secondary {
  background: transparent;
  color: var(--pink-light);
  border: var(--border-pink);
  box-shadow: 0 0 0 0 rgba(255,45,120,0);
}

.btn--secondary:hover {
  background: rgba(255, 45, 120, 0.1);
  box-shadow: var(--glow-pink);
  transform: translateY(-2px);
}

/* ── Ghost (Transparent) ────────────────────────────────── */
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn--ghost:hover {
  color: var(--text-secondary);
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.04);
}

/* ── Replay (small, subtle) ─────────────────────────────── */
.btn--replay {
  background: transparent;
  color: var(--text-dim);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 8px 20px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.btn--replay:hover {
  color: var(--text-muted);
  border-color: rgba(255,255,255,0.15);
}

/* ── Large variant ──────────────────────────────────────── */
.btn--large {
  padding: 16px 40px;
  font-size: var(--fs-lg);
  letter-spacing: 0.02em;
}

/* ── Pulse animation (CTA) ──────────────────────────────── */
.btn--pulse {
  animation: btnPulse 2.8s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% {
    box-shadow: var(--glow-pink), 0 0 0 0 rgba(255,45,120,0);
  }
  50% {
    box-shadow: var(--glow-pink), 0 0 0 14px rgba(255,45,120,0.08);
  }
}

/* ── Hidden (for reveal animation) ─────────────────────── */
.btn--hidden {
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity var(--t-slow), transform var(--t-slow);
}

.btn--hidden.btn--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* ── Button icon ────────────────────────────────────────── */
.btn__icon {
  font-style: normal;
  flex-shrink: 0;
  display: inline-block;
  transition: transform var(--t-bounce);
}

.btn:hover .btn__icon {
  transform: translateX(-4px);
}

/* ── Bounce animation (answer click) ───────────────────── */
@keyframes btnBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  70%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}

.btn--bouncing {
  animation: btnBounce 0.4s var(--t-bounce) forwards;
}

/* ╔══════════════════════════════════╗
   ║       QUIZ OPTION BUTTONS        ║
   ╚══════════════════════════════════╝ */

.quiz__option {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  width: 100%;
  padding: 16px 20px;
  background: var(--bg-option);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  text-align: right;
  direction: rtl;
  transition:
    background var(--t-normal),
    border-color var(--t-normal),
    box-shadow var(--t-normal),
    transform var(--t-bounce);
  position: relative;
  overflow: hidden;
}

.quiz__option::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 3px;
  background: linear-gradient(180deg, var(--pink), var(--purple));
  opacity: 0;
  transition: opacity var(--t-normal);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.quiz__option:hover {
  background: var(--bg-option-hover);
  border-color: rgba(255, 45, 120, 0.3);
  transform: translateX(-4px);
}

.quiz__option:hover::before {
  opacity: 1;
}

.quiz__option:active {
  transform: scale(0.97) !important;
}

.quiz__option.is-selected {
  background: rgba(255, 45, 120, 0.15);
  border-color: rgba(255, 45, 120, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 45, 120, 0.2), inset 0 0 16px rgba(255,45,120,0.05);
  animation: optionBounce 0.4s var(--t-bounce) forwards;
}

.quiz__option.is-selected::before {
  opacity: 1;
}

@keyframes optionBounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.04) translateX(-2px); }
  65%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

/* Option letter badge */
.quiz__option-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  font-family: var(--font-accent);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--t-normal), color var(--t-normal);
}

.quiz__option.is-selected .quiz__option-badge {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
}

/* ╔══════════════════════════════════╗
   ║       PROGRESS BARS              ║
   ╚══════════════════════════════════╝ */

/* Quiz progress bar */
.quiz__progress-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.quiz__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan));
  background-size: 200% 100%;
  border-radius: var(--radius-full);
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressShimmer 2.5s linear infinite;
  box-shadow: 0 0 8px rgba(255, 45, 120, 0.5);
  will-change: width;
}

@keyframes progressShimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Analysis progress bar */
.analysis__progress-wrap {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.analysis__progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan));
  background-size: 200% 100%;
  border-radius: var(--radius-full);
  transition: width 100ms linear;
  animation: progressShimmer 2s linear infinite;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
}

/* ╔══════════════════════════════════╗
   ║          MODAL                   ║
   ╚══════════════════════════════════╝ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-sm);
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 250ms ease;
}

.modal__card {
  position: relative;
  z-index: 1;
  padding: var(--gap-lg) var(--gap-md);
  max-width: 340px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-md);
  animation: modalSlideUp 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal__emoji {
  font-size: 3rem;
}

.modal__text {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.7;
}

.modal__text em {
  color: var(--text-muted);
  font-style: normal;
  font-size: var(--fs-md);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ╔══════════════════════════════════╗
   ║       WARNING BADGE              ║
   ╚══════════════════════════════════╝ */

.warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: rgba(255, 45, 120, 0.1);
  border: var(--border-pink);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--pink-light);
  letter-spacing: 0.03em;
  animation: badgePop 0.6s var(--t-bounce) forwards;
}

.warning-badge__icon {
  font-size: 1.1rem;
  animation: shakeIcon 2s ease-in-out 1s infinite;
}

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

@keyframes shakeIcon {
  0%, 85%, 100% { transform: rotate(0deg); }
  90%  { transform: rotate(-15deg); }
  95%  { transform: rotate(15deg); }
}

/* ╔══════════════════════════════════╗
   ║       CARD ORBS (decorative)     ║
   ╚══════════════════════════════════╝ */

.card-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: cardOrbFloat 6s ease-in-out infinite;
  z-index: 0;
}

.card-orb--a {
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(255,45,120,0.35), transparent 70%);
  top: -30px;
  left: -30px;
  filter: blur(20px);
  animation-delay: 0s;
}

.card-orb--b {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(168,85,247,0.35), transparent 70%);
  bottom: -20px;
  right: -20px;
  filter: blur(18px);
  animation-delay: -3s;
}

@keyframes cardOrbFloat {
  0%, 100% { transform: translate(0, 0); }
  50%       { transform: translate(8px, -10px); }
}

/* ╔══════════════════════════════════╗
   ║    SCORE GAUGE (SVG)             ║
   ╚══════════════════════════════════╝ */

.result__gauge {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.gauge__track {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 10;
}

.gauge__fill {
  fill: none;
  stroke: url(#gauge-gradient);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 339.29; /* 2π × 54 */
  stroke-dashoffset: 339.29;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.gauge__score-num {
  fill: var(--text-primary);
  font-family: var(--font-accent);
  font-size: 28px;
  font-weight: 900;
  transform: rotate(90deg);
  transform-origin: 70px 62px;
}

.gauge__score-label {
  fill: var(--text-muted);
  font-family: var(--font-arabic);
  font-size: 11px;
  font-weight: 600;
  transform: rotate(90deg);
  transform-origin: 70px 82px;
}

/* ╔══════════════════════════════════════════════════════════╗
   ║   V2 UPGRADES — RUNNING BUTTON                           ║
   ╚══════════════════════════════════════════════════════════╝ */

/* The btn-thinking button in runner mode (position:fixed set by JS) */
.btn--runner {
  transition:
    left   250ms cubic-bezier(0.34, 1.56, 0.64, 1),
    top    250ms cubic-bezier(0.34, 1.56, 0.64, 1),
    transform var(--t-bounce),
    background var(--t-normal),
    color var(--t-normal) !important;
  cursor: crosshair;
  white-space: nowrap;
}

/* When the button has been caught after 15 escapes */
.btn--runner.is-caught {
  background: rgba(0, 240, 255, 0.1) !important;
  border-color: rgba(0, 240, 255, 0.4) !important;
  color: var(--cyan) !important;
  cursor: pointer;
  animation: caughtPulse 0.6s var(--t-bounce) forwards;
}

@keyframes caughtPulse {
  0%   { transform: scale(1) rotate(0deg); }
  30%  { transform: scale(1.15) rotate(-5deg); }
  60%  { transform: scale(0.92) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* Shake animation when button is escaping */
@keyframes runnerShake {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(-8deg) scale(1.05); }
  40%  { transform: rotate(6deg) scale(0.97); }
  60%  { transform: rotate(-4deg) scale(1.03); }
  80%  { transform: rotate(3deg) scale(0.98); }
  100% { transform: rotate(0deg) scale(1); }
}

.btn--runner.is-escaping {
  animation: runnerShake 0.3s ease forwards;
}

/* ╔══════════════════════════════════════════════════════════╗
   ║   V2 UPGRADES — DODGE HUD                                ║
   ╚══════════════════════════════════════════════════════════╝ */

.dodge-hud {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 8, 20, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--cyan);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
  animation: hudSlideDown 350ms var(--t-bounce) both;
  pointer-events: none;
}

.dodge-hud[hidden] { display: none; }

#dodge-emoji { font-size: 1.3rem; }

#dodge-msg {
  color: var(--text-secondary);
  font-weight: 600;
}

.dodge-count {
  font-family: var(--font-accent);
  font-weight: 900;
  color: var(--pink);
  font-size: var(--fs-md);
  min-width: 32px;
  text-align: center;
}

@keyframes hudSlideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* HUD update flash */
.dodge-hud.flash {
  animation: hudFlash 300ms ease;
}

@keyframes hudFlash {
  0%, 100% { border-color: rgba(0, 240, 255, 0.3); }
  50%       { border-color: var(--pink); box-shadow: 0 0 25px rgba(255, 45, 120, 0.4); }
}

/* ╔══════════════════════════════════════════════════════════╗
   ║   V2 UPGRADES — FLOATING EMOJI RAIN                      ║
   ╚══════════════════════════════════════════════════════════╝ */

#emoji-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

/* Each floating emoji element */
.floating-emoji {
  position: absolute;
  font-size: 1.4rem;
  pointer-events: none;
  user-select: none;
  animation: floatUp 1.4s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0%   { transform: translateY(0) scale(0.4) rotate(0deg);   opacity: 1; }
  40%  { transform: translateY(-60px) scale(1.1) rotate(15deg); opacity: 1; }
  100% { transform: translateY(-130px) scale(0.8) rotate(-10deg); opacity: 0; }
}

/* ╔══════════════════════════════════════════════════════════╗
   ║   V2 UPGRADES — FUN QUIZ OPTION HOVER (Wiggle)           ║
   ╚══════════════════════════════════════════════════════════╝ */

/* Override: options now wobble on hover */
.quiz__option:hover {
  background: var(--bg-option-hover);
  border-color: rgba(255, 45, 120, 0.35);
  transform: translateX(-6px) rotate(-0.6deg);
  box-shadow: 0 4px 16px rgba(255, 45, 120, 0.15);
}

/* Wiggle keyframe triggered by JS on mouseenter */
@keyframes optionWiggle {
  0%   { transform: translateX(0) rotate(0deg); }
  20%  { transform: translateX(-5px) rotate(-1deg); }
  40%  { transform: translateX(4px) rotate(0.8deg); }
  60%  { transform: translateX(-3px) rotate(-0.5deg); }
  80%  { transform: translateX(2px) rotate(0.3deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

.quiz__option.is-wiggling {
  animation: optionWiggle 0.45s ease both;
}

/* Sparkle effect on selected option */
.quiz__option.is-selected::after {
  content: '✨';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  animation: sparkleIn 0.5s ease forwards;
}

@keyframes sparkleIn {
  from { opacity: 0; transform: translateY(-50%) scale(0) rotate(0deg); }
  60%  { opacity: 1; transform: translateY(-50%) scale(1.3) rotate(20deg); }
  to   { opacity: 1; transform: translateY(-50%) scale(1) rotate(0deg); }
}

/* ╔══════════════════════════════════════════════════════════╗
   ║   V2 UPGRADES — FLIRTY HEART RAIN ON RESULT              ║
   ╚══════════════════════════════════════════════════════════╝ */

/* Ambient hearts that rain in the background on high score */
.heart-rain-drop {
  position: fixed;
  top: -40px;
  font-size: 1.2rem;
  pointer-events: none;
  animation: heartFall linear forwards;
  z-index: 0;
  opacity: 0.6;
}

@keyframes heartFall {
  0%   { transform: translateY(0) rotate(0deg) scale(0.8);   opacity: 0.7; }
  50%  { transform: translateY(50vh) rotate(180deg) scale(1); opacity: 0.5; }
  100% { transform: translateY(105vh) rotate(360deg) scale(0.6); opacity: 0; }
}

/* ╔══════════════════════════════════════════════════════════╗
   ║   V2 UPGRADES — EMAIL STATUS TOAST                       ║
   ╚══════════════════════════════════════════════════════════╝ */

.email-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #fff;
  backdrop-filter: blur(12px);
  pointer-events: none;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1), opacity 400ms ease;
  opacity: 0;
  white-space: nowrap;
}

.email-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.email-toast--success {
  background: rgba(16, 185, 129, 0.85);
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.email-toast--error {
  background: rgba(255, 45, 120, 0.85);
  border: 1px solid rgba(255, 45, 120, 0.5);
  box-shadow: 0 0 20px rgba(255, 45, 120, 0.3);
}

