/* ========== Design Tokens ========== */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f8;
  --bg-card: #ffffff;
  --accent-cyan: #2563EB;
  --accent-purple: #7c3aed;
  --accent-pink: #e11d48;
  --accent-green: #16a34a;
  --accent-orange: #ea580c;
  --text-primary: #0a0a0a;
  --text-secondary: #525252;
  --border: #e5e5e5;
  --glass: rgba(255, 255, 255, 0.9);
  --shadow-glow: 0 4px 24px rgba(0, 0, 0, 0.07);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-lg: 20px;
  --font-head: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Black button palette */
  --btn-bg: #0a0a0a;
  --btn-hover: #1f1f1f;
  --btn-text: #ffffff;
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.25s ease;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: 3.5rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.25rem; }

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.gradient-text {
  background: linear-gradient(135deg, #0a0a0a 0%, #525252 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.accent-text {
  color: var(--accent-cyan);
}

/* ========== Button System ========== */
.btn-gradient {
  background: var(--btn-bg);
  border: 2px solid var(--btn-bg);
  color: var(--btn-text);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 50px;
  padding: 14px 32px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1f1f1f, #3a3a3a);
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: inherit;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  background: #fff !important;
  color: #000 !important;
  border: 1.5px solid #000 !important;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.btn-gradient:hover::before {
  opacity: 0;
}

.btn-gradient span,
.btn-gradient i,
.btn-gradient svg {
  position: relative;
  z-index: 1;
}

.btn-gradient:active {
  transform: translateY(0);
  box-shadow: none;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.badge-dot.connected {
  background: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
  animation: pulse-dot-green 2s infinite;
}

.badge-dot.disconnected {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
  animation: none;
}

.badge-dot.searching {
  background: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
  animation: pulse-dot-yellow 1s infinite;
}

@keyframes pulse-dot-green {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

@keyframes pulse-dot-yellow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 50px;
  padding: 14px 32px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--text-primary);
  color: white;
  border-color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* ========== Skip Link (Accessibility) ========== */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10000;
}

.skip-link-anchor {
  position: absolute;
  top: -100px;
  left: 24px;
  background: var(--btn-bg);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: top 0.3s ease;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.skip-link-anchor:focus {
  top: 24px;
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ========== Navigation ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(229, 229, 229, 0.6);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), background 0.3s ease, box-shadow 0.3s ease;
  padding-top: env(safe-area-inset-top, 0);
  transform: translateY(0);
}

.navbar.navbar-hidden {
  transform: translateY(-100%);
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.logo .logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.logo .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo:hover .logo-icon {
  transform: rotate(-10deg) scale(1.1);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-chat-btn {
  background: var(--btn-bg);
  color: white !important;
  border-radius: 50px !important;
  padding: 10px 20px !important;
  font-weight: 600 !important;
  transition: all 0.25s ease !important;
}

.nav-chat-btn:hover {
  background: #1f1f1f !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-toggle:hover {
  background: #f0f0f1;
  border-color: var(--text-primary);
}

.nav-toggle span {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 19px; }
.nav-toggle span:nth-child(3) { top: 24px; }

.nav-toggle.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.nav-toggle.active span {
  background: #fff;
  left: 11px;
}

.nav-toggle.active span:nth-child(1) {
  top: 19px;
  transform: rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.nav-toggle.active span:nth-child(3) {
  top: 19px;
  transform: rotate(-45deg);
}

/* ========== Footer ========== */
.footer {
  background: #0a0a0a;
  color: #fff;
  border-top: none;
  padding: 80px 24px 40px;
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
}

.footer-brand h3 {
  font-size: 1.3rem;
  margin-bottom: 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand h3 .footer-logo-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.footer-brand h3 .footer-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.footer-brand p {
  font-size: 0.9rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.55);
}

.footer-column h4 {
  font-size: 0.8rem;
  margin-bottom: 20px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 500;
}

.footer-column ul {
  list-style: none;
}

.footer-column li {
  margin-bottom: 12px;
}

.footer-column a {
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-column a:hover {
  color: #fff;
}

.footer-bottom {
  max-width: 1200px;
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-bottom p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
}

.social-icons {
  display: flex;
  gap: 12px;
}

.social-icons a {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  transition: all 0.25s ease;
}

.social-icons a:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
  transform: translateY(-2px);
}

/* ========== Utility Classes ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

#chat-modal {
  display: none !important;
}

#option-room {
  display: none !important;
}

.page-content {
  padding-top: 100px;
  min-height: calc(100vh - 300px);
}

.text-center { text-align: center; }
.hidden { display: none !important; }

/* ========== Responsive Navigation ========== */
@media (max-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.5rem; }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    background: #fff;
    flex-direction: column;
    padding: 80px 24px 40px;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: -1;
  }

  .nav-links.active {
    transform: translateY(0);
  }

  .navbar-container {
    padding: 20px 24px;
  }

  .nav-links a {
    width: 100%;
    display: block;
    padding: 12px 16px;
    border-radius: 10px;
  }

  .footer-container {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .btn-gradient,
  .btn-secondary {
    padding: 13px 24px;
    font-size: 0.9rem;
  }

  .footer-container {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ========== Background Animations ========== */
.hero, .chat-container {
  position: relative;
  overflow: hidden;
}

/* Hero Canvas - Absolute within section */
#hero-canvas, #messages-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Chat Canvas - Fixed to background */
#chat-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* Floating ambient orbs (CSS pseudo-elements) */
.hero::before, .hero::after, .chat-container::before, .chat-container::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.6;
}

/* Top-right Blue Orb */
.hero::before, .chat-container::before {
  top: -200px;
  right: -100px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, transparent 70%);
  animation: float-orb 15s ease-in-out infinite;
}

/* Bottom-left Purple Orb */
.hero::after, .chat-container::after {
  bottom: -150px;
  left: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, transparent 70%);
  animation: float-orb 18s ease-in-out infinite reverse;
}

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 60px) scale(1.1); }
}
