/* === Custom Properties === */
:root {
  --bg: #09090b;
  --bg-card: #111113;
  --bg-card-hover: #18181b;
  --pro: #3b82f6;
  --pro-dim: rgba(59, 130, 246, 0.03);
  --pro-glow: rgba(59, 130, 246, 0.15);
  --con: #ef4444;
  --con-dim: rgba(239, 68, 68, 0.03);
  --con-glow: rgba(239, 68, 68, 0.15);
  --neutral: #a855f7;
  --neutral-glow: rgba(168, 85, 247, 0.15);
  --amber: #f59e0b;
  --green: #22c55e;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --border: #27272a;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* === Input View === */
.input-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
  transition: opacity var(--transition);
}

.input-view::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06), transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(239, 68, 68, 0.06), transparent 60%);
  pointer-events: none;
  transition: opacity 0.6s;
  z-index: 0;
}

.input-view.is-loading::before {
  animation: pulseGradients 2s ease-in-out infinite;
}

@keyframes pulseGradients {
  0%, 100% {
    background:
      radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06), transparent 60%),
      radial-gradient(ellipse at 80% 50%, rgba(239, 68, 68, 0.06), transparent 60%);
  }
  50% {
    background:
      radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.18), transparent 60%),
      radial-gradient(ellipse at 80% 50%, rgba(239, 68, 68, 0.18), transparent 60%);
  }
}

.input-view > * {
  position: relative;
  z-index: 1;
}

.input-view.hidden {
  display: none;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  animation: fadeSlideUp 0.6s ease-out;
}

.logo__icon {
  width: 48px;
  height: 48px;
}

.logo__text {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pro), var(--neutral), var(--con));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 3rem;
  text-align: center;
  animation: fadeSlideUp 0.6s ease-out 0.1s both;
}

/* Search Bar */
.search-area {
  width: 100%;
  max-width: 640px;
  animation: fadeSlideUp 0.6s ease-out 0.2s both;
}

.search-bar {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  border-color: var(--neutral);
  box-shadow: 0 0 0 3px var(--neutral-glow);
}

.search-hint {
  display: block;
  text-align: right;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.search-hint kbd {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Debate Button */
.btn-debate {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--pro), var(--neutral), var(--con));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-debate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--neutral-glow);
}

.btn-debate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-debate.loading {
  animation: pulseBtn 1.5s ease-in-out infinite;
}

@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 0 0 0 var(--neutral-glow); }
  50% { box-shadow: 0 0 20px 5px var(--neutral-glow); }
}

.btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Sample Chips */
.sample-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 640px;
  margin-top: 2rem;
}

.chip {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeSlideUp 0.4s ease-out both;
}

.chip:nth-child(1) { animation-delay: 0.3s; }
.chip:nth-child(2) { animation-delay: 0.35s; }
.chip:nth-child(3) { animation-delay: 0.4s; }
.chip:nth-child(4) { animation-delay: 0.45s; }
.chip:nth-child(5) { animation-delay: 0.5s; }
.chip:nth-child(6) { animation-delay: 0.55s; }

.chip:hover {
  border-color: var(--neutral);
  color: var(--text);
  transform: scale(1.05);
  box-shadow: 0 0 12px var(--neutral-glow);
}

/* === Debate View === */
.debate-view {
  display: none;
  padding-bottom: 5rem;
}

.debate-view.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

.debate-view.hidden {
  display: none;
}

/* === FAB === */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--pro), var(--neutral), var(--con));
  color: white;
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 100;
}

.fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.fab.hidden {
  display: none;
}

/* === Toast System === */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  padding: 0.875rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform 0.3s ease-out, opacity 0.3s;
  opacity: 0;
  max-width: 360px;
}

.toast.active {
  transform: translateX(0);
  opacity: 1;
}

.toast--success { border-left: 3px solid var(--green); }
.toast--error { border-left: 3px solid var(--con); }
.toast--info { border-left: 3px solid var(--pro); }

/* === Animations === */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* === Mobile Tabs (shown only on small screens) === */
.mobile-tabs {
  display: none;
  gap: 0;
  margin: 0 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.mobile-tab {
  flex: 1;
  padding: 0.75rem;
  background: var(--bg-card);
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
}

.mobile-tab--pro.active {
  background: var(--pro-glow);
  color: var(--pro);
}

.mobile-tab--con.active {
  background: var(--con-glow);
  color: var(--con);
}

/* === Responsive === */
@media (max-width: 1024px) {
  .mobile-tabs {
    display: flex;
  }

  .split-panel {
    flex-direction: column !important;
  }

  .split-panel__divider {
    display: none !important;
  }

  .split-panel__col--pro,
  .split-panel__col--con {
    width: 100% !important;
  }

  .split-panel.show-pro .split-panel__col--con,
  .split-panel.show-con .split-panel__col--pro {
    display: none;
  }
}

@media (max-width: 768px) {
  .logo__text {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.95rem;
    margin-bottom: 2rem;
  }

  .search-bar {
    flex-direction: column;
  }

  .btn-debate {
    justify-content: center;
  }

  .sample-topics {
    gap: 0.4rem;
  }

  .chip {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }

  .fab {
    bottom: 1rem;
    right: 1rem;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 4.5rem;
  }

  .toast {
    max-width: 100%;
  }
}
