/* ==========================================================================
   NEXUS AI WEBSITE BUILDER — Design System & Styles
   ========================================================================== */

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

:root {
  /* Colors - Unconventional & Striking Neon Synthwave */
  --electric-blue: #a855f7;        /* Vibrant Neon Purple/Amethyst */
  --electric-blue-dark: #7e22ce;   /* Deep Royal Purple */
  --electric-blue-light: #00f5d4;  /* Bright Hyper Turquoise/Mint */
  --electric-blue-glow: rgba(168, 85, 247, 0.25);
  --pure-white: #FFFFFF;
  --soft-gray: #130f26;            /* Deep Space Dark Blue-Purple */
  --surface: #07050f;              /* Near-black Obsidian space backdrop */
  --surface-container: #1b1635;    /* Dark purple-tinted surface containers */
  --on-surface: #f3eff7;           /* Bright lilac white for high contrast text */
  --on-surface-variant: #a99cb8;   /* Muted lilac text */
  --outline: #3e3150;              /* Lilac-tinted dark border outline */
  --outline-variant: #5c4978;      /* Lilac-tinted medium border outline */
  --inverse-surface: #f3eff7;
  --inverse-on-surface: #07050f;
  --error: #ff3366;                /* Neon Crimson Red */
  --success: #00f5d4;              /* Neon Turquoise Green */
  --ai-accent: rgba(0, 245, 212, 0.1); /* Translucent Neon Turquoise background */

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --container-max: 1280px;
  --gutter: 24px;
  --section-padding: 120px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; display: block; }
input, textarea { font-family: inherit; outline: none; border: none; }

/* ---------- Typography ---------- */
.text-display { font-size: 64px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.text-headline-lg { font-size: 32px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.text-headline-md { font-size: 24px; font-weight: 600; line-height: 1.33; letter-spacing: -0.01em; }
.text-body-lg { font-size: 18px; font-weight: 400; line-height: 1.56; }
.text-body-md { font-size: 16px; font-weight: 400; line-height: 1.5; }
.text-label-md { font-size: 14px; font-weight: 500; line-height: 1.43; letter-spacing: 0.01em; }
.text-label-sm { font-size: 12px; font-weight: 600; line-height: 1.33; letter-spacing: 0.05em; text-transform: uppercase; }

.text-gradient {
  background: linear-gradient(135deg, var(--electric-blue), var(--electric-blue-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Glass & Elevation ---------- */
.glass {
  background: rgba(18, 13, 33, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-strong {
  background: rgba(22, 17, 43, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.shadow-ambient { box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.05); }
.shadow-elevated { box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.08); }
.shadow-glow { box-shadow: 0 0 40px var(--electric-blue-glow); }

/* ---------- Layout ---------- */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 40px; }
.section { padding: var(--section-padding) 0; }

@media (max-width: 768px) {
  .container { padding: 0 20px; }
  .text-display { font-size: 36px; }
  .section { padding: 80px 0; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--electric-blue);
  color: var(--pure-white);
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 102, 255, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--on-surface);
  border: 1.5px solid var(--outline-variant);
}
.btn-secondary:hover {
  border-color: var(--electric-blue);
  color: var(--electric-blue);
  background: var(--ai-accent);
}

.btn-ghost {
  color: var(--on-surface-variant);
  padding: 8px 16px;
}
.btn-ghost:hover { background: var(--soft-gray); color: var(--on-surface); }

.btn-white {
  background: var(--pure-white);
  color: var(--on-surface);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.btn-white:hover { transform: translateY(-2px) scale(1.02); }

/* Ripple Effect */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn:hover::after { opacity: 1; }

/* ---------- Navigation ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 0;
  transition: all 0.4s var(--ease-out);
}
.navbar.scrolled {
  padding: 10px 0;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.06);
}
.navbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
}
.navbar-logo img { height: 32px; width: auto; }
.navbar-links { display: flex; gap: 32px; }
.navbar-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
  transition: color 0.2s;
  position: relative;
}
.navbar-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--electric-blue);
  transition: width 0.3s var(--ease-out);
}
.navbar-links a:hover { color: var(--electric-blue); }
.navbar-links a:hover::after { width: 100%; }
.navbar-actions { display: flex; align-items: center; gap: 16px; }

/* Mobile Menu */
.mobile-menu-btn { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.mobile-menu-btn span { width: 22px; height: 2px; background: var(--on-surface); transition: all 0.3s; }
.mobile-menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  opacity: 0;
  transition: opacity 0.3s;
}
.mobile-menu.active { display: flex; opacity: 1; }
.mobile-menu a { font-size: 24px; font-weight: 600; }

@media (max-width: 768px) {
  .navbar-links, .navbar-actions .btn-ghost { display: none; }
  .mobile-menu-btn { display: flex; }
}

/* ---------- Hero Section ---------- */
.hero {
  position: relative;
  padding-top: 160px;
  padding-bottom: var(--section-padding);
  text-align: center;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--electric-blue-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Animated orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: orbFloat 12s ease-in-out infinite;
  pointer-events: none;
}
.orb-1 { width: 300px; height: 300px; background: var(--electric-blue); top: 20%; left: 10%; animation-delay: 0s; }
.orb-2 { width: 200px; height: 200px; background: #b3c5ff; top: 60%; right: 15%; animation-delay: -4s; }
.orb-3 { width: 250px; height: 250px; background: #dae1ff; bottom: 10%; left: 30%; animation-delay: -8s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -20px) scale(1.05); }
  50% { transform: translate(-10px, 20px) scale(0.95); }
  75% { transform: translate(-30px, -10px) scale(1.02); }
}

.hero-content { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; }

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 102, 255, 0.1);
  font-size: 13px;
  font-weight: 600;
  color: var(--electric-blue);
  margin-bottom: 24px;
  animation: fadeInDown 0.8s var(--ease-out);
}

.hero h1 { margin-bottom: 20px; animation: fadeInUp 0.8s var(--ease-out) 0.1s both; }
.hero p { color: var(--on-surface-variant); max-width: 600px; margin: 0 auto 48px; animation: fadeInUp 0.8s var(--ease-out) 0.2s both; }

/* Prompt Bar */
.prompt-bar-wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  animation: fadeInUp 0.8s var(--ease-out) 0.3s both;
}
.prompt-bar-glow {
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.2), rgba(179, 197, 255, 0.2));
  filter: blur(12px);
  opacity: 0;
  transition: opacity 0.5s;
}
.prompt-bar-wrap:hover .prompt-bar-glow,
.prompt-bar-wrap:focus-within .prompt-bar-glow { opacity: 1; }

.prompt-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 24px;
  border-radius: var(--radius-lg);
  transition: box-shadow 0.3s;
}
.prompt-bar:focus-within { box-shadow: 0 0 0 3px var(--electric-blue-glow); }

.prompt-bar .icon { color: var(--on-surface-variant); font-size: 22px; transition: color 0.3s; }
.prompt-bar:focus-within .icon { color: var(--electric-blue); }
.prompt-bar input {
  flex: 1;
  height: 52px;
  background: transparent;
  font-size: 16px;
  color: var(--on-surface);
}
.prompt-bar input::placeholder { color: var(--outline); }

.prompt-bar .btn-primary { padding: 14px 32px; font-size: 15px; border-radius: 18px; white-space: nowrap; }

/* Showcase Cards */
.showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
  max-width: var(--container-max);
  margin: 64px auto 0;
  animation: fadeInUp 0.8s var(--ease-out) 0.5s both;
}
.showcase-card {
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow: hidden;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s;
}
.showcase-card:hover { transform: scale(1.02) translateY(-4px); }
.showcase-card:hover { box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.1); }
.showcase-card:nth-child(2) { transform: translateY(-32px); }
.showcase-card:nth-child(2):hover { transform: translateY(-36px) scale(1.02); }
.showcase-card img {
  width: 100%;
  height: 380px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

@media (max-width: 768px) {
  .hero { padding-top: 120px; min-height: auto; }
  .showcase { grid-template-columns: 1fr; }
  .showcase-card:nth-child(2) { transform: none; }
  .showcase-card:nth-child(2):hover { transform: scale(1.02); }
  .showcase-card img { height: 240px; }
}

/* ---------- Templates Section ---------- */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
}
.template-card {
  cursor: pointer;
  transition: transform 0.4s var(--ease-out);
}
.template-card:hover { transform: translateY(-8px); }
.template-thumb {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
}
.template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out);
}
.template-card:hover .template-thumb img { transform: scale(1.1); }
.template-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  backdrop-filter: blur(4px);
}
.template-card:hover .template-overlay { opacity: 1; }
.template-card h3 {
  font-size: 16px;
  font-weight: 600;
  transition: color 0.3s;
}
.template-card:hover h3 { color: var(--electric-blue); }

@media (max-width: 1024px) { .templates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .templates-grid { grid-template-columns: 1fr; } }

/* ---------- Features Section ---------- */
.features-bg { background: var(--soft-gray); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
}
.feature-card {
  padding: 32px;
  border-radius: var(--radius-lg);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s;
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 25px 50px -15px rgba(0, 0, 0, 0.08);
}
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ai-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--electric-blue);
  margin-bottom: 16px;
  font-size: 22px;
}
.feature-card h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { color: var(--on-surface-variant); font-size: 15px; line-height: 1.6; }

@media (max-width: 768px) { .features-grid { grid-template-columns: 1fr; } }

/* ---------- Agency Section ---------- */
.agency {
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  overflow: hidden;
}
.agency-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}
.agency-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 24px;
}
.agency h2 { font-size: 48px; font-weight: 700; line-height: 1.15; margin-bottom: 20px; }
.agency p { color: #c6c6c7; font-size: 18px; line-height: 1.6; margin-bottom: 32px; }
.agency-checks { list-style: none; margin-bottom: 40px; }
.agency-checks li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 16px;
}
.agency-checks .material-symbols-outlined { color: var(--electric-blue-light); }
.agency-image {
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.5s;
}
.agency-image:hover { box-shadow: 0 30px 60px rgba(0, 102, 255, 0.2); }
.agency-image img { width: 100%; height: 500px; object-fit: cover; object-position: left top; transition: transform 0.7s var(--ease-out); }
.agency-image:hover img { transform: scale(1.04); }
.agency-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

@media (max-width: 768px) {
  .agency-grid { grid-template-columns: 1fr; }
  .agency h2 { font-size: 32px; }
  .agency-image img { height: 300px; }
}

/* ---------- Pricing Section ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
  align-items: start;
}
.pricing-card {
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s;
  position: relative;
}
.pricing-card:hover { transform: translateY(-6px); }
.pricing-card.featured {
  border: 2px solid var(--electric-blue);
  box-shadow: 0 20px 50px rgba(0, 102, 255, 0.12);
}
.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 20px;
  background: var(--electric-blue);
  color: white;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}
.pricing-card h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.pricing-price { font-size: 48px; font-weight: 700; margin-bottom: 4px; }
.pricing-price span { font-size: 16px; font-weight: 400; color: var(--on-surface-variant); }
.pricing-period { color: var(--on-surface-variant); font-size: 14px; margin-bottom: 24px; }
.pricing-features { list-style: none; margin-bottom: 32px; }
.pricing-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 15px;
  color: var(--on-surface-variant);
}
.pricing-features .material-symbols-outlined { font-size: 18px; color: var(--success); }

@media (max-width: 768px) { .pricing-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.footer { background: var(--on-surface); color: #c6c6c7; padding: 80px 0 40px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
.footer-brand { font-size: 14px; line-height: 1.7; }
.footer-brand h4 { font-size: 22px; font-weight: 700; color: white; margin-bottom: 12px; }
.footer-col h5 { font-size: 14px; font-weight: 600; color: white; margin-bottom: 16px; letter-spacing: 0.02em; }
.footer-col a {
  display: block;
  padding: 4px 0;
  font-size: 14px;
  color: #999;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--electric-blue-light); }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.footer-social { display: flex; gap: 16px; }
.footer-social a:hover { color: var(--electric-blue-light); }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 12px; }
}

/* ==========================================================================
   CHAT PANEL — AI Agent Interface
   ========================================================================== */
.chat-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 200;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--electric-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0, 102, 255, 0.4);
  transition: all 0.3s var(--ease-spring);
  font-size: 28px;
}
.chat-toggle:hover { transform: scale(1.1); box-shadow: 0 12px 40px rgba(0, 102, 255, 0.5); }
.chat-toggle.active { transform: rotate(180deg) scale(1.1); }

/* Chat Panel */
.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease-out);
  box-shadow: -10px 0 50px rgba(0, 0, 0, 0.1);
}
.chat-panel.open { transform: translateX(0); }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--outline-variant);
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 12px; }
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--electric-blue), #4d94ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}
.chat-title { font-weight: 600; font-size: 16px; }
.chat-status { font-size: 12px; color: var(--success); display: flex; align-items: center; gap: 4px; }
.chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

.chat-header-actions { display: flex; gap: 8px; }
.chat-header-actions button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: var(--on-surface-variant);
  font-size: 20px;
}
.chat-header-actions button:hover { background: var(--soft-gray); }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 4px; }

.message {
  max-width: 90%;
  animation: messageIn 0.3s var(--ease-out);
}
.message-user {
  align-self: flex-end;
  background: var(--electric-blue);
  color: white;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  font-size: 15px;
  line-height: 1.5;
}
.message-ai {
  align-self: flex-start;
  background: var(--soft-gray);
  padding: 16px 20px;
  border-radius: 18px 18px 18px 4px;
  font-size: 15px;
  line-height: 1.6;
}
.message-ai p { margin-bottom: 8px; }
.message-ai p:last-child { margin-bottom: 0; }
.message-ai a { color: var(--electric-blue); text-decoration: underline; }

.message-time {
  font-size: 11px;
  color: var(--outline);
  margin-top: 4px;
  padding: 0 4px;
}
.message-user + .message-time { text-align: right; }

/* Agent Status / Generation Steps */
.agent-status {
  align-self: flex-start;
  width: 100%;
  max-width: 95%;
  padding: 16px;
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.04), rgba(179, 197, 255, 0.08));
  border: 1px solid rgba(0, 102, 255, 0.1);
  border-radius: var(--radius-md);
  animation: messageIn 0.3s var(--ease-out);
}
.agent-status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--electric-blue);
  margin-bottom: 12px;
}
.agent-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--on-surface-variant);
  animation: stepIn 0.4s var(--ease-out);
}
.agent-step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  margin-top: 1px;
}
.agent-step-icon.loading {
  border: 2px solid var(--outline-variant);
  border-top-color: var(--electric-blue);
  animation: spin 0.8s linear infinite;
}
.agent-step-icon.done {
  background: var(--success);
  color: white;
  font-size: 13px;
}
.agent-step-icon.error {
  background: var(--error);
  color: white;
  font-size: 13px;
}
.agent-step-text { flex: 1; }
.agent-step-text .sub-step {
  font-size: 12px;
  color: var(--outline);
  padding-left: 4px;
  animation: fadeIn 0.3s;
}

/* Progress Bar */
.agent-progress {
  margin-top: 12px;
  height: 4px;
  background: var(--outline-variant);
  border-radius: 4px;
  overflow: hidden;
}
.agent-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--electric-blue), var(--electric-blue-light));
  border-radius: 4px;
  transition: width 0.5s var(--ease-out);
  position: relative;
}
.agent-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

/* Preview Card in Chat */
.preview-card {
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--outline-variant);
  background: white;
  animation: fadeInUp 0.4s var(--ease-out);
}
.preview-card-header {
  padding: 10px 16px;
  background: var(--soft-gray);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.preview-card-header .dots { display: flex; gap: 6px; }
.preview-card-header .dot { width: 10px; height: 10px; border-radius: 50%; }
.preview-card-header .dot-red { background: #ff5f57; }
.preview-card-header .dot-yellow { background: #febc2e; }
.preview-card-header .dot-green { background: #28c840; }
.preview-card-body { height: 200px; overflow: hidden; }
.preview-card-body iframe { width: 100%; height: 600px; border: none; transform: scale(0.34); transform-origin: top left; width: 295%; pointer-events: none; }
.preview-card-actions { padding: 10px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--outline-variant); }
.preview-card-actions button { font-size: 13px; padding: 6px 16px; }

/* Chat Input */
.chat-input-wrap {
  padding: 16px 24px;
  border-top: 1px solid var(--outline-variant);
  flex-shrink: 0;
}
.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--soft-gray);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: box-shadow 0.3s, border-color 0.3s;
  border: 1.5px solid transparent;
}
.chat-input:focus-within {
  border-color: var(--electric-blue);
  box-shadow: 0 0 0 3px var(--electric-blue-glow);
  background: white;
}
.chat-input textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.5;
  min-height: 24px;
  max-height: 120px;
  padding: 6px 0;
  color: var(--on-surface);
}
.chat-input textarea::placeholder { color: var(--outline); }
.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--electric-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  font-size: 20px;
}
.chat-send:hover { background: var(--electric-blue-dark); transform: scale(1.05); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Memory indicator */
.memory-indicator {
  padding: 8px 24px;
  font-size: 12px;
  color: var(--outline);
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(0,0,0,0.04);
  flex-shrink: 0;
}
.memory-indicator .material-symbols-outlined { font-size: 14px; }

@media (max-width: 600px) {
  .chat-panel { width: 100%; }
}

/* ==========================================================================
   FULL PAGE PREVIEW
   ========================================================================== */
.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: stretch;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}
.preview-overlay.active { display: flex; opacity: 1; }

.preview-frame {
  width: 100%;
  max-width: 1400px;
  margin: 24px;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.4s var(--ease-out);
}
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--soft-gray);
  border-bottom: 1px solid var(--outline-variant);
}
.preview-toolbar-left { display: flex; align-items: center; gap: 16px; }
.preview-toolbar .dots { display: flex; gap: 6px; }
.preview-toolbar .dot { width: 12px; height: 12px; border-radius: 50%; }
.preview-url {
  padding: 6px 16px;
  background: white;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--outline);
  border: 1px solid var(--outline-variant);
}
.preview-toolbar-right { display: flex; gap: 8px; }
.preview-iframe-wrap { flex: 1; overflow: auto; }
.preview-iframe-wrap iframe { width: 100%; height: 100%; border: none; min-height: 600px; }

/* ==========================================================================
   LOGIN MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  border-radius: var(--radius-xl);
  animation: scaleIn 0.3s var(--ease-out);
}
.modal h2 { margin-bottom: 8px; }
.modal p { color: var(--on-surface-variant); margin-bottom: 24px; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  transition: background 0.2s;
}
.modal-close:hover { background: var(--soft-gray); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--soft-gray);
  font-size: 15px;
  transition: all 0.3s;
  border: 1.5px solid transparent;
}
.form-group input:focus {
  border-color: var(--electric-blue);
  background: white;
  box-shadow: 0 0 0 3px var(--electric-blue-glow);
}
.form-actions { margin-top: 24px; }
.form-actions .btn { width: 100%; justify-content: center; padding: 14px; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes stepIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }
.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }

/* Stagger delays */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }

/* ---------- Section Title Common ---------- */
.section-header { text-align: center; max-width: 600px; margin: 0 auto 48px; }
.section-header h2 { margin-bottom: 12px; }
.section-header p { color: var(--on-surface-variant); }

/* ---------- Misc ---------- */
.text-center { text-align: center; }
.mt-48 { margin-top: 48px; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* Typing indicator */
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--outline);
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Welcome message in chat */
.welcome-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--on-surface-variant);
}
.welcome-msg .material-symbols-outlined { font-size: 48px; color: var(--electric-blue); margin-bottom: 12px; }
.welcome-msg h3 { font-size: 18px; font-weight: 600; color: var(--on-surface); margin-bottom: 8px; }
.welcome-msg p { font-size: 14px; line-height: 1.6; }
.quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.quick-prompt {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--ai-accent);
  color: var(--electric-blue);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid rgba(0, 102, 255, 0.1);
}
.quick-prompt:hover { background: var(--electric-blue); color: white; }

/* ==========================================================================
   STUDIO WORKSPACE & PREMIUM ADDITIONS
   ========================================================================== */

/* Studio Workspace Layout */
.builder-workspace {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: var(--surface);
  color: var(--on-surface);
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  animation: fadeIn 0.4s var(--ease-out);
}
.workspace-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--outline);
  z-index: 10;
  flex-shrink: 0;
}
.workspace-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.workspace-divider {
  color: var(--outline-variant);
  font-weight: 300;
  font-size: 20px;
}
.workspace-project-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--electric-blue-light);
  background: rgba(168, 85, 247, 0.1);
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.workspace-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.workspace-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 24px;
  gap: 24px;
}
.workspace-chat-pane {
  width: 420px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.workspace-preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.preview-browser {
  flex: 1;
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--outline);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  background: #141129; /* Sleek workspace browser dark background */
}
.preview-browser-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--outline);
  background: rgba(19, 14, 38, 0.4);
  flex-shrink: 0;
}
.preview-browser-header .dots {
  display: flex;
  gap: 8px;
}
.preview-browser-header .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.preview-browser-header .dot-red { background: #ff5f57; }
.preview-browser-header .dot-yellow { background: #febc2e; }
.preview-browser-header .dot-green { background: #28c840; }
.preview-browser-url {
  font-size: 13px;
  color: var(--on-surface-variant);
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 40px;
  border-radius: 8px;
  border: 1px solid var(--outline);
  font-family: monospace;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.preview-browser-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-browser-actions button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  transition: all 0.2s;
}
.preview-browser-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-surface);
}
.preview-browser-viewport {
  flex: 1;
  position: relative;
  background: #ffffff; /* Page content is white by default */
}
.preview-browser-viewport iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}
.preview-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 5, 15, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  z-index: 5;
  transition: opacity 0.3s var(--ease-out);
}
.preview-loading-content {
  max-width: 320px;
}
.preview-loading-content .pulse-glow {
  font-size: 48px;
  color: var(--electric-blue-light);
  animation: pulseGlow 2s infinite ease-in-out;
  display: inline-block;
}
@keyframes pulseGlow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(0,245,212,0.3)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(0,245,212,0.8)); }
}

.chat-panel-nested {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--outline);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

/* User Profile styles */
.user-profile {
  position: relative;
}
.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--outline);
  color: var(--on-surface);
  transition: all 0.2s;
}
.profile-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--electric-blue-light);
}
.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--electric-blue), var(--electric-blue-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  border: 1px solid var(--outline);
  animation: fadeInUp 0.2s var(--ease-out);
}
.profile-dropdown.active {
  display: flex;
}
.dropdown-header {
  display: flex;
  flex-direction: column;
}
.dropdown-header .user-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--on-surface);
}
.dropdown-header .user-email {
  font-size: 12px;
  color: var(--on-surface-variant);
}
.dropdown-divider {
  height: 1px;
  background: var(--outline);
  margin: 4px 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--on-surface-variant);
  font-size: 14px;
  text-align: left;
  transition: all 0.2s;
  background: transparent;
  width: 100%;
}
.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--electric-blue-light);
}

/* Google & Microsoft Social login buttons */
.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--on-surface-variant);
  font-size: 13px;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--outline);
}
.login-divider:not(:empty)::before { margin-right: .5em; }
.login-divider:not(:empty)::after { margin-left: .5em; }

.social-login-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.btn-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  background: var(--soft-gray);
  border: 1px solid var(--outline);
  color: var(--on-surface);
  transition: all 0.3s var(--ease-out);
}
.btn-social:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--electric-blue-light);
  transform: translateY(-1px);
}
.btn-social svg {
  flex-shrink: 0;
}

/* Auth Loading Overlay */
.auth-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 5, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}
.auth-loading-card {
  padding: 32px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--outline);
  text-align: center;
  max-width: 320px;
  width: 100%;
  animation: scaleIn 0.3s var(--ease-out);
}
.spin-glow {
  display: inline-block;
  animation: spin 1.2s linear infinite;
}

/* Firebase status badge in navbar */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  margin-right: 8px;
}
.status-badge:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--electric-blue);
}
.status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s ease;
}
.status-badge.local .status-dot {
  background: #ffb59d;
  box-shadow: 0 0 8px rgba(255, 181, 157, 0.5);
}
.status-badge.cloud .status-dot {
  background: #00F5D4;
  box-shadow: 0 0 8px rgba(0, 245, 212, 0.5);
}

/* Pichiku Education modal styles */
.rule-item {
  transition: all 0.2s ease;
}
.rule-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: var(--electric-blue) !important;
}
.delete-rule-btn {
  opacity: 0.6;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.delete-rule-btn:hover {
  opacity: 1;
  color: #ff3366 !important;
  transform: scale(1.1);
}
