/* Tosche Station v3.0 — Star Wars Light Theme
   Jedi Temple / Tantive IV aesthetic: warm cream, rebel blue, protocol gold */

/* ========================================================================
   Design Tokens
   ======================================================================== */
:root {
  --sw-bg: #FAF7F2;
  --sw-surface: #FFFFFF;
  --sw-border: #E8E0D4;
  --sw-text: #2D2926;
  --sw-text-muted: #8C7E6F;
  --sw-primary: #1B7FBF;
  --sw-primary-dark: #135E8E;
  --sw-accent: #C9952D;
  --sw-accent-light: #F5E6C4;
  --sw-danger: #C41E3A;
  --sw-success: #2D8A4E;
  --sw-banner-bg: #12110E;
  --sw-terminal: #0E1A2B;
}

/* ========================================================================
   Utility
   ======================================================================== */
.hidden { display: none !important; }

/* ========================================================================
   Ambient top lightsaber streak
   ======================================================================== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 10%, var(--sw-accent) 50%, transparent 90%);
  z-index: 200;
  opacity: 0.5;
  pointer-events: none;
}

/* Subtle ambient glow on body */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(27, 127, 191, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(201, 149, 45, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

/* ========================================================================
   Product Image Hover
   ======================================================================== */
.product-img { transition: transform 0.3s ease; }
.product-img:hover { transform: scale(1.05); }

/* ========================================================================
   Code Blocks (holographic terminal)
   ======================================================================== */
.code-block {
  background: var(--sw-terminal);
  color: #5BC0EB;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid rgba(91, 192, 235, 0.12);
  box-shadow: inset 0 0 40px rgba(91, 192, 235, 0.03);
}

/* Syntax highlighting */
.syn-key { color: var(--sw-accent); }
.syn-str { color: #5BC0EB; }
.syn-num { color: #E8A54B; }
.syn-bool { color: #E55B72; }

/* ========================================================================
   Toast Notifications
   ======================================================================== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  animation: toast-in 0.3s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(1rem); }
}

/* ========================================================================
   Chat Bubbles
   ======================================================================== */
.chat-bubble-user {
  background: linear-gradient(135deg, var(--sw-primary), var(--sw-primary-dark));
  color: white;
  border-radius: 1rem 1rem 0.25rem 1rem;
}
.chat-bubble-bot {
  background: #F0EBE1;
  color: var(--sw-text);
  border-radius: 1rem 1rem 1rem 0.25rem;
}

/* ========================================================================
   Typing Indicator
   ======================================================================== */
.typing-dot {
  width: 6px; height: 6px;
  background: var(--sw-text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ========================================================================
   Chat Trigger (R2-D2 FAB)
   ======================================================================== */
.chat-trigger-pulse {
  box-shadow: 0 0 0 0 rgba(27, 127, 191, 0.5);
  animation: pulse-ring 2.5s ease-out infinite, chat-wobble 4s ease-in-out 3s infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(27, 127, 191, 0.5); }
  70% { box-shadow: 0 0 0 14px rgba(27, 127, 191, 0); }
  100% { box-shadow: 0 0 0 0 rgba(27, 127, 191, 0); }
}
@keyframes chat-wobble {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-6deg); }
  30% { transform: rotate(5deg); }
  45% { transform: rotate(-3deg); }
  60% { transform: rotate(0deg); }
}

/* R2-D2 eye glow */
.r2-eye-glow {
  animation: eye-glow 3s ease-in-out infinite;
}
@keyframes eye-glow {
  0%, 100% { opacity: 0.7; r: 1.2; }
  50% { opacity: 1; r: 1.6; }
}

/* ========================================================================
   Bot Simulator Log
   ======================================================================== */
.bot-log-entry.success { color: #2D8A4E; }
.bot-log-entry.blocked { color: #C41E3A; }
.bot-log-entry.error { color: var(--sw-accent); }

/* ========================================================================
   Scrollbar
   ======================================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sw-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sw-text-muted); }

/* ========================================================================
   Star Wars Hero (starfield)
   ======================================================================== */
.sw-hero {
  position: relative;
  background: #0B1929;
}
.sw-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--sw-primary), var(--sw-accent), var(--sw-primary), transparent);
  opacity: 0.7;
  z-index: 5;
}

/* ========================================================================
   Lightsaber Glow Effects
   ======================================================================== */
.sw-glow-blue {
  box-shadow: 0 0 15px rgba(27, 127, 191, 0.25), 0 0 30px rgba(27, 127, 191, 0.08);
}
.sw-glow-gold {
  box-shadow: 0 0 15px rgba(201, 149, 45, 0.25), 0 0 30px rgba(201, 149, 45, 0.08);
}

/* ========================================================================
   Mobile Hamburger Menu
   ======================================================================== */
.hamburger-line {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  transition: transform 0.3s, opacity 0.3s;
  border-radius: 1px;
}
.hamburger-open .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.hamburger-open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger-open .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.mobile-nav-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.mobile-nav-menu.open {
  max-height: 400px;
}

/* ========================================================================
   Attack Playground
   ======================================================================== */
.playground-wrap { margin: -1rem -1rem 0; }
.attack-cat-item { transition: background 0.15s, border-color 0.15s; }
.attack-cat-item:hover { background: var(--sw-accent-light); }
.attack-cat-item.active { background: #EBF5FB; border-left: 3px solid var(--sw-primary); color: var(--sw-primary-dark); font-weight: 600; }
.attack-sub-item { transition: background 0.15s; }
.attack-sub-item:hover { background: #FAF7F2; }
.attack-sub-item.active { background: #EBF5FB; color: var(--sw-primary); font-weight: 500; }
.status-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.025em; }
.status-2xx { background: #dcfce7; color: #166534; }
.status-3xx { background: #e0f2fe; color: #075985; }
.status-4xx { background: #fef3c7; color: #92400e; }
.status-5xx { background: #fee2e2; color: #991b1b; }
.status-err { background: #fce4ec; color: #b71c1c; }
.header-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.25rem; }
.header-row input { font-size: 0.8rem; }
.section-toggle { cursor: pointer; user-select: none; }
.section-toggle::before { content: '\25B6'; display: inline-block; margin-right: 0.35rem; font-size: 0.6rem; transition: transform 0.15s; }
.section-toggle.open::before { transform: rotate(90deg); }
.history-item { transition: background 0.1s; cursor: pointer; }
.history-item:hover { background: var(--sw-accent-light); }

/* ========================================================================
   Mobile Chatbot — Full Screen with Visible Controls
   ======================================================================== */
@media (max-width: 640px) {
  #chat-panel {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: none !important;
    border-radius: 0 !important;
    z-index: 100 !important;
  }

  /* Larger touch targets for header buttons */
  .chat-header-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Safe area padding for input */
  .chat-input-area {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* ========================================================================
   Mobile Bot Simulator
   ======================================================================== */
@media (max-width: 1024px) {
  .bot-layout {
    flex-direction: column !important;
    height: auto !important;
  }
  .bot-layout .bot-config {
    width: 100% !important;
  }
  .bot-layout .bot-results {
    min-height: 400px;
  }
}

/* ========================================================================
   Star Wars accent utilities
   ======================================================================== */
.sw-gold { color: var(--sw-accent); }
.sw-gold-bg { background-color: var(--sw-accent-light); }
.sw-border-gold { border-color: var(--sw-accent); }
.sw-border-glow {
  border: 1px solid rgba(27, 127, 191, 0.2);
  box-shadow: 0 0 0 1px rgba(27, 127, 191, 0.05);
}
