/* ==========================================================================
   Kalasar Interactive Click-Through Arcade Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Dark Obsidian Glass Theme variables */
  --bg-dark: hsl(230, 15%, 5%);
  --bg-card: hsl(230, 15%, 8%);
  --bg-card-hover: rgba(255, 255, 255, 0.04);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(168, 85, 247, 0.15);
  
  /* Cyber HSL accents */
  --color-primary: hsl(263, 90%, 51%);   /* Purple */
  --color-secondary: hsl(271, 91%, 65%); /* Lavender */
  --color-accent: hsl(190, 95%, 45%);     /* Glowing Cyan */
  --color-success: hsl(150, 84%, 43%);    /* Emerald Green */
  --color-warning: hsl(35, 92%, 50%);     /* Amber Gold */
  
  /* Typography weights & tones */
  --text-primary: hsl(210, 20%, 96%);
  --text-secondary: hsl(215, 15%, 72%);
  --text-muted: hsl(220, 10%, 46%);
  
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(168, 85, 247, 0.15);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; /* App takes exactly the full viewport height */
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Layout Structure
   -------------------------------------------------------------------------- */
.arcade-app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* Top Navigation Bar */
.arcade-header {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: block;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.control-toggle-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.control-toggle-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.control-toggle-btn.active {
  color: var(--color-accent);
  background: rgba(19, 229, 244, 0.05);
  border-color: rgba(19, 229, 244, 0.2);
}

.back-docs-link {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.15rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
  transition: var(--transition-smooth);
}

.back-docs-link:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(168, 85, 247, 0.3);
}

/* Core Split Workspace */
.arcade-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

/* Left Sidebar checklist progress panel */
.arcade-sidebar {
  width: 320px;
  background: hsl(230, 15%, 6%);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-headline {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.steps-progress-container {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.75rem 2rem 0.75rem;
  gap: 0.35rem;
}

/* Individual step list element */
.tour-step-nav-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.tour-step-nav-item:hover {
  background: var(--bg-card-hover);
}

.tour-step-nav-item.active {
  background: rgba(168, 85, 247, 0.04);
  border-color: var(--border-glow);
  box-shadow: inset 2px 0 0 var(--color-primary);
}

.tour-step-nav-item.active .step-nav-indicator {
  border-color: var(--color-secondary);
  color: var(--color-secondary);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.step-nav-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

/* Completion states */
.tour-step-nav-item.completed .step-nav-indicator {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #030712;
}

.tour-step-nav-item.completed .step-nav-title {
  color: var(--text-secondary);
  text-decoration: none;
}

.step-nav-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.step-nav-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.tour-step-nav-item.active .step-nav-title {
  color: var(--text-primary);
}

.step-nav-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.tour-step-nav-item.active .step-nav-desc {
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Center Arena Display Area
   -------------------------------------------------------------------------- */
.arcade-display-arena {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem;
  overflow-y: auto;
  gap: 1.25rem;
  align-items: center;
  justify-content: center;
}

/* Device Chrome Browser frame */
.browser-mockup-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-premium), var(--shadow-glow);
  width: 100%;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: var(--transition-smooth);
}

.browser-mockup-header {
  height: 40px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-dots {
  display: flex;
  gap: 0.35rem;
}

.header-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.header-dots .dot.red { background-color: #ef4444; }
.header-dots .dot.yellow { background-color: #f59e0b; }
.header-dots .dot.green { background-color: #10b981; }

.browser-url-bar {
  flex: 1;
  max-width: 550px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-size-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* Image screen rendering frame */
.browser-screen-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #090d16;
  overflow: hidden;
}

.active-screenshot {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Overlay hotspot tracker layer */
.hotspot-overlay-pane {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Pulsing Hotspots & Tooltips
   -------------------------------------------------------------------------- */
.pulse-hotspot {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hotspot-core {
  width: 100%;
  height: 100%;
  border-radius: 8px; /* rectangle/rounded border match */
  border: 2px solid var(--color-accent);
  background: rgba(19, 229, 244, 0.15);
  box-shadow: 0 0 15px var(--color-accent);
  animation: hotspot-pulse 1.8s infinite ease-in-out;
  position: relative;
}

@keyframes hotspot-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(19, 229, 244, 0.7), 0 0 10px rgba(19, 229, 244, 0.3);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(19, 229, 244, 0), 0 0 10px rgba(19, 229, 244, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(19, 229, 244, 0), 0 0 10px rgba(19, 229, 244, 0.3);
  }
}

/* Floating Guided Action Tooltip */
.hotspot-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  width: 240px;
  color: white;
  pointer-events: none;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(168, 85, 247, 0.05);
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

/* Display tooltip automatically */
.pulse-hotspot:hover .hotspot-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tooltip-indicator {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  display: block;
  margin-bottom: 0.25rem;
}

.tooltip-message {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-primary);
}

/* Tooltip Little arrow caret */
.hotspot-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.9) transparent transparent transparent;
}

/* --------------------------------------------------------------------------
   Step Description Explanation Panel
   -------------------------------------------------------------------------- */
.step-explanation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  width: 100%;
  max-width: 1080px;
  box-shadow: var(--shadow-premium);
  flex-shrink: 0;
}

.explanation-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.explanation-phase-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-secondary);
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.explanation-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Visual Ripple Feedback
   -------------------------------------------------------------------------- */
.viewport-ripple-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
}

.click-ripple {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(19, 229, 244, 0.4) 0%, rgba(168, 85, 247, 0.1) 70%, rgba(168, 85, 247, 0) 100%);
  border: 2px solid var(--color-accent);
  transform: translate(-50%, -50%) scale(0.1);
  opacity: 1;
  animation: click-ripple-expand 0.35s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes click-ripple-expand {
  0% {
    transform: translate(-50%, -50%) scale(0.1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Bottom Controls Footer Navigation
   -------------------------------------------------------------------------- */
.arcade-controls-footer {
  height: 72px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

/* Progress indicator styles */
.footer-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 320px;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Navigation button group styling */
.footer-btn-group {
  display: flex;
  gap: 0.75rem;
}

.footer-action-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.footer-action-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.footer-action-btn.accent {
  background: rgba(168, 85, 247, 0.07);
  border-color: var(--border-glow);
  color: var(--color-secondary);
}

.footer-action-btn.accent:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
  color: white;
}

.footer-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Responsive Media Queries & Scaling Bounds
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .arcade-sidebar {
    width: 260px;
  }
  .footer-progress-wrapper {
    width: 240px;
  }
}

@media (max-width: 840px) {
  body {
    overflow-y: auto;
    height: auto;
  }
  .arcade-app-container {
    height: auto;
  }
  .arcade-workspace {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .arcade-sidebar {
    width: 100%;
    height: 240px;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
  .arcade-display-arena {
    padding: 1rem;
    height: auto;
  }
  .arcade-controls-footer {
    flex-direction: column;
    height: auto;
    padding: 1.5rem 1rem;
    gap: 1rem;
  }
  .footer-progress-wrapper {
    width: 100%;
  }
  .footer-btn-group {
    width: 100%;
    justify-content: space-between;
  }
  .footer-action-btn {
    flex: 1;
    justify-content: center;
  }
}

/* Premium Explanation Action Hint */
.explanation-action-hint {
  margin-top: 0.85rem;
  padding: 0.6rem 1rem;
  background: rgba(19, 229, 244, 0.04);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.45;
  box-shadow: inset 10px 0 20px rgba(19, 229, 244, 0.01);
}

.explanation-action-hint strong {
  color: var(--color-accent);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  margin-right: 0.25rem;
}
