:root {
  --bg: #0A0A10;
  --bg-panel: #12111A;
  --bg-card: #17151F;
  --border: rgba(255,255,255,0.08);
  --text: #F4F3F8;
  --text-dim: rgba(244,243,248,0.62);
  --text-faint: rgba(244,243,248,0.4);
  --violet: #7C4DFF;
  --violet-light: #9D7BFF;
  --violet-soft: rgba(124,77,255,0.16);
  --green: #3ECF8E;
  --sans: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--sans); }
i[data-lucide] { width: 18px; height: 18px; display: inline-block; stroke-width: 1.8; }

/* ============ HEADER ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 40px; height: 40px;
  background: var(--violet);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon i { color: white; }

.wordmark { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.wordmark span { color: var(--violet-light); }
.brand-tag { font-size: 0.72rem; color: var(--text-faint); }

.search-bar {
  flex: 1;
  max-width: 560px;
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  outline: none;
}
.search-bar input::placeholder { color: var(--text-faint); }
.search-btn {
  background: var(--violet);
  border: none;
  width: 46px;
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.account-nav { display: flex; gap: 26px; margin-left: auto; }
.account-link {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.85rem; color: var(--text-dim);
  position: relative;
  white-space: nowrap;
}
.account-link:hover { color: var(--text); }
.cart-badge {
  position: absolute;
  top: -8px; left: 10px;
  background: var(--violet);
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
}

/* ============ SUBNAV ============ */
.subnav {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
}
.categories-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--violet);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.main-links { display: flex; gap: 28px; }
.main-links a { font-size: 0.9rem; color: var(--text-dim); padding-bottom: 4px; border-bottom: 2px solid transparent; }
.main-links a.active, .main-links a:hover { color: var(--text); border-color: var(--violet); }

/* ============ HERO ============ */
.hero {
  position: relative;
  margin: 24px 40px;
  padding: 56px 48px;
  border-radius: 20px;
  background: linear-gradient(120deg, #1B1230 0%, #120E1E 65%, #0A0A10 100%);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 24px;
  overflow: hidden;
}
.eyebrow { font-size: 0.9rem; color: var(--text-dim); margin: 0 0 14px; }
.eyebrow span { color: var(--violet-light); font-weight: 600; }
.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
.hero-sub { color: var(--text-dim); max-width: 420px; margin: 0 0 28px; }
.cta-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--violet);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 13px 22px;
  border-radius: 9px;
}
.cta-btn:hover { background: var(--violet-light); }

.hero-visual { display: flex; justify-content: center; align-items: center; }
.hero-visual img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  filter: drop-shadow(0 30px 60px rgba(124,77,255,0.35));
}
.hero-visual img.hero-fallback {
  border-radius: 16px;
  max-height: 320px;
  object-fit: cover;
}

.hero-dots {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
}
.hero-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.25); }
.hero-dots .dot.active { background: var(--violet-light); width: 18px; border-radius: 4px; }

/* ============ CATEGORIES ============ */
.categories {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  padding: 0 40px;
  margin-bottom: 28px;
}
.category-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.category-item:hover { border-color: var(--violet); }
.category-item i { color: var(--violet-light); width: 22px; height: 22px; }
.category-item span { font-size: 0.78rem; color: var(--text-dim); text-align: center; }

/* ============ TRUST BADGES ============ */
.trust-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 0 40px;
  margin-bottom: 40px;
}
.badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; gap: 12px;
}
.badge i { color: var(--green); width: 22px; height: 22px; flex-shrink: 0; }
.badge strong { display: block; font-size: 0.85rem; }
.badge span { font-size: 0.75rem; color: var(--text-faint); }

/* ============ PRODUCTS ============ */
.products-section { padding: 0 40px 60px; }
.products-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px;
}
.products-header h2 { font-size: 1.3rem; margin: 0; }
.see-all { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--violet-light); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.product-card:hover { border-color: var(--violet); transform: translateY(-2px); }
.product-card img {
  width: 100%; height: 150px;
  object-fit: contain;
  background: #FFFFFF;
  padding: 14px;
}
.product-card .info { padding: 14px 16px 16px; }
.product-card .cat {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}
.product-card h3 { font-size: 0.95rem; margin: 6px 0 4px; }
.product-card .stars { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--text-faint); margin-bottom: 10px; }
.product-card .stars i { width: 13px; height: 13px; color: #F5B93C; }
.product-card .price-row { display: flex; align-items: center; justify-content: space-between; }
.price { font-weight: 700; color: var(--text); }
.add-btn {
  background: var(--violet);
  border: none;
  color: white;
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.add-btn i { width: 16px; height: 16px; }

.footnote {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  padding: 20px 20px 100px;
  border-top: 1px solid var(--border);
}

/* ============ CHAT BUBBLE ============ */
.chat-bubble {
  position: fixed;
  bottom: 26px; right: 26px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--violet);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(124,77,255,0.45);
  z-index: 40;
  transition: transform 0.15s ease;
}
.chat-bubble:hover { transform: scale(1.06); }
.chat-bubble i { width: 26px; height: 26px; color: white; }

/* ============ CHAT PANEL ============ */
.chat-panel {
  position: fixed;
  bottom: 26px; right: 26px;
  width: 400px;
  max-height: 640px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  z-index: 50;
  overflow: hidden;
}
.chat-panel.hidden { display: none; }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.chat-header-left { display: flex; align-items: center; gap: 10px; }
.assistant-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--violet-soft);
  display: flex; align-items: center; justify-content: center;
}
.assistant-avatar i { color: var(--violet-light); width: 19px; height: 19px; }
.chat-status { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-faint); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.chat-header-right { display: flex; gap: 6px; }
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-dim);
}
.icon-btn i { width: 15px; height: 15px; }
.icon-btn:hover { border-color: var(--violet); color: var(--text); }

.guardrail-status {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  font-family: var(--mono);
  font-size: 0.68rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-on { background: var(--green); box-shadow: 0 0 0 3px rgba(62,207,142,0.18); }
.dot-off { background: #FF5C5C; box-shadow: 0 0 0 3px rgba(255,92,92,0.18); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
}

.msg { font-size: 0.85rem; padding: 10px 13px; border-radius: 10px; max-width: 92%; }
.msg.user { align-self: flex-end; background: var(--violet); color: white; border-bottom-right-radius: 3px; }
.msg.bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  white-space: pre-wrap;
  max-width: 96%;
}

.msg.bot table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.68rem;
}
.msg.bot th, .msg.bot td {
  border: 1px solid var(--border);
  padding: 5px 7px;
  text-align: left;
  white-space: nowrap;
}
.msg.bot th { background: rgba(124,77,255,0.14); color: var(--violet-light); }

.quick-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 18px 12px;
}
.quick-actions button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 0.72rem;
  cursor: pointer;
}
.quick-actions button:hover { border-color: var(--violet); color: var(--text); }

.chat-form {
  display: flex; gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 0.85rem;
  outline: none;
}
.chat-form input::placeholder { color: var(--text-faint); }
.send-btn {
  background: var(--violet);
  border: none;
  color: white;
  width: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.send-btn i { width: 17px; height: 17px; }

.debug-panel { border-top: 1px solid var(--border); padding: 8px 18px 12px; font-size: 0.78rem; }
.debug-panel summary {
  cursor: pointer; font-family: var(--mono); color: var(--text-faint);
  display: flex; align-items: center; gap: 6px; font-size: 0.7rem;
}
.debug-panel summary i { width: 13px; height: 13px; }
.debug-panel pre {
  font-family: var(--mono);
  font-size: 0.68rem;
  background: #060609;
  color: #B9AFE0;
  padding: 10px;
  border-radius: 6px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
}

.chat-footer {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-faint);
  padding: 8px 0 12px;
}
.chat-footer strong { color: var(--violet-light); }

@media (max-width: 980px) {
  .categories { grid-template-columns: repeat(4, 1fr); }
  .trust-badges { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .account-nav span { display: none; }
  .chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
  .categories { grid-template-columns: repeat(2, 1fr); }
}
