/* ── Landing Page ──────────────────────────────────────────── */
.hero {
  padding: 6rem 1.5rem 5rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary-lt) 0%, var(--bg) 60%);
}
.hero h1 { font-size: 3rem; margin-bottom: 1rem; }
.hero h1 em { color: var(--primary); font-style: normal; }
.hero p  { font-size: 1.2rem; max-width: 600px; margin: 0 auto 2.5rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.features { padding: 5rem 1.5rem; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-icon {
  width: 52px; height: 52px;
  background: var(--primary-lt);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}
.feature-card h3 { margin-bottom: .5rem; }

.how-it-works { padding: 5rem 1.5rem; background: var(--bg-card); }
.steps { display: flex; gap: 2rem; flex-wrap: wrap; justify-content: center; margin-top: 3rem; }
.step {
  flex: 1; min-width: 200px; max-width: 280px;
  text-align: center; position: relative;
}
.step-num {
  width: 44px; height: 44px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
  margin: 0 auto 1rem;
}
.step h3 { margin-bottom: .5rem; }

.cta-section {
  padding: 5rem 1.5rem;
  text-align: center;
  background: var(--primary);
  color: #fff;
}
.cta-section h2 { color: #fff; }
.cta-section p  { color: rgba(255,255,255,.8); font-size: 1.1rem; margin-bottom: 2rem; }
.cta-section .btn-outline { border-color: #fff; color: #fff; }
.cta-section .btn-outline:hover { background: rgba(255,255,255,.1); }

.landing-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
}

/* ── Auth Page ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}
.auth-container { width: 100%; max-width: 440px; }
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 700;
  font-size: 1.4rem;
}
.auth-logo span { color: var(--primary); }
.auth-card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); padding: 2.5rem; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 2rem; border-bottom: 2px solid var(--border); }
.auth-tab {
  flex: 1; padding: .65rem; background: none; border: none;
  cursor: pointer; font-size: .95rem; font-family: var(--font);
  color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all var(--transition);
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-divider { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-divider span { color: var(--text-muted); font-size: .8rem; }

/* ── App Layout (dashboard / owner / admin) ────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: background var(--transition);
}
.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
}
.sidebar-header span { color: var(--primary); }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  background: none; border-right: none; border-top: none; border-bottom: none;
  width: 100%; text-align: left; font-family: var(--font);
}
.nav-item:hover { background: var(--bg-input); color: var(--text); }
.nav-item.active { color: var(--primary); border-left-color: var(--primary); background: var(--primary-lt); }
.nav-icon { font-size: 1.1rem; width: 20px; }
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.sidebar-user { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: .75rem; color: var(--text-muted); }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.page-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-header h2 { font-size: 1.1rem; }
.page-body { flex: 1; padding: 2rem; overflow-y: auto; }

/* ── Chat Panel ────────────────────────────────────────────── */
.chat-layout { display: flex; gap: 1.5rem; height: calc(100vh - 130px); }

.product-panel {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.product-search { position: relative; }
.product-search input { padding-left: 2.25rem; }
.product-search-icon {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.category-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.category-chip {
  padding: .3rem .75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  font-size: .78rem;
  cursor: pointer;
  background: none;
  color: var(--text-muted);
  font-family: var(--font);
  transition: all var(--transition);
}
.category-chip.active { border-color: var(--primary); color: var(--primary); background: var(--primary-lt); }
.product-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.product-item {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
}
.product-item:hover { border-color: var(--primary); }
.product-item.selected { border-color: var(--primary); background: var(--primary-lt); }
.product-item-name { font-size: .9rem; font-weight: 500; }
.product-item-meta { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.chat-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem;
}
.chat-header h3 { font-size: 1rem; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); text-align: center; gap: .75rem;
}
.chat-empty-icon { font-size: 3rem; opacity: .4; }

.message { display: flex; gap: .75rem; max-width: 85%; }
.message.user { flex-direction: row-reverse; align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.message-bubble {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.6;
}
.message.user .message-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}
.message.assistant .message-bubble {
  background: var(--bg-input);
  color: var(--text);
  border-bottom-left-radius: var(--radius-sm);
}
.message-image {
  max-width: 200px;
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  border: 1px solid var(--border);
}
.message-time { font-size: .7rem; color: var(--text-muted); margin-top: .3rem; }
.message-feedback { display: flex; gap: .25rem; margin-top: .4rem; }
.feedback-btn {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .2rem .5rem;
  cursor: pointer; font-size: .85rem; transition: all var(--transition);
}
.feedback-btn:hover { border-color: var(--primary); }
.feedback-btn.active { background: var(--primary-lt); border-color: var(--primary); }
.suggested-questions { margin-top: .75rem; display: flex; flex-direction: column; gap: .35rem; }
.suggested-q {
  font-size: .8rem; color: var(--primary); background: var(--primary-lt);
  border: none; border-radius: var(--radius-sm);
  padding: .35rem .75rem; cursor: pointer; text-align: left;
  font-family: var(--font); transition: all var(--transition);
}
.suggested-q:hover { opacity: .85; }

.chat-input-area {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.image-preview-area {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .5rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.image-preview-area.visible { display: flex; }
.image-preview-area img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); }
.chat-input-row { display: flex; gap: .5rem; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: .65rem .9rem;
}
.chat-actions { display: flex; gap: .35rem; }
.icon-btn {
  width: 40px; height: 40px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all var(--transition); flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--primary); background: var(--primary-lt); }
.icon-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; animation: voice-pulse 1.2s ease-out infinite; }
@keyframes voice-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(79,70,229,.4); }
  70%  { box-shadow: 0 0 0 10px rgba(79,70,229,0); }
  100% { box-shadow: 0 0 0 0 rgba(79,70,229,0); }
}

/* ── Voice Recording Overlay ───────────────────────────────── */
.voice-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 300;
  align-items: flex-end; justify-content: center;
  padding-bottom: 120px;
}
.voice-overlay.active { display: flex; }
.voice-overlay-card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 2rem 2.5rem;
  text-align: center; min-width: 280px; max-width: 360px;
  box-shadow: var(--shadow-md);
  animation: voice-slide-up .2s ease;
}
@keyframes voice-slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.voice-waveform { display: flex; gap: 5px; align-items: center; justify-content: center; height: 44px; margin-bottom: 1rem; }
.voice-waveform span { width: 4px; border-radius: 2px; background: var(--primary); transform-origin: center; animation: waveform-bar 1s ease-in-out infinite; }
.voice-waveform span:nth-child(1) { height: 14px; animation-delay: 0s;   }
.voice-waveform span:nth-child(2) { height: 26px; animation-delay: .1s;  }
.voice-waveform span:nth-child(3) { height: 40px; animation-delay: .2s;  }
.voice-waveform span:nth-child(4) { height: 26px; animation-delay: .1s;  }
.voice-waveform span:nth-child(5) { height: 14px; animation-delay: 0s;   }
@keyframes waveform-bar {
  0%,100% { transform: scaleY(.35); }
  50%     { transform: scaleY(1);   }
}
.voice-waveform.paused span { animation-play-state: paused; }
.voice-overlay-status { color: var(--text-muted); font-size: .875rem; margin-bottom: .25rem; }
.voice-overlay-timer  { font-size: 2rem; font-weight: 700; color: var(--primary); letter-spacing: .05em; margin-bottom: 1.25rem; }
.voice-stop-btn       { width: 100%; }
.voice-overlay-hint   { font-size: .75rem; color: var(--text-muted); margin-top: .75rem; }
.voice-captured-badge {
  display: none; align-items: center; gap: .3rem;
  font-size: .75rem; color: var(--primary);
  background: var(--primary-lt); border: 1px solid rgba(79,70,229,.2);
  border-radius: var(--radius-sm); padding: .15rem .5rem; margin-right: .4rem;
}
.voice-captured-badge.visible { display: inline-flex; }
.voice-badge-dismiss { background: none; border: none; cursor: pointer; color: inherit; font-size: .85rem; padding: 0 0 0 .2rem; line-height: 1; opacity: .7; }
.voice-badge-dismiss:hover { opacity: 1; }
.voice-msg-tag { display: inline-flex; align-items: center; gap: .2rem; font-size: .7rem; opacity: .65; margin-left: .4rem; vertical-align: middle; }

/* ── Web Search ─────────────────────────────────────────────── */
.web-search-offer-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .6rem; padding: .35rem .75rem;
  font-size: .8rem; font-family: var(--font);
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text); transition: all var(--transition);
}
.web-search-offer-btn:hover { border-color: var(--primary); background: var(--primary-lt); color: var(--primary); }
.web-search-offer-btn:disabled { opacity: .6; cursor: default; }
.web-search-sources { margin-top: .75rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.web-sources-label { font-size: .72rem; color: var(--text-muted); margin-bottom: .35rem; font-weight: 500; letter-spacing: .02em; }
.web-source-item {
  display: block; font-size: .78rem; color: var(--primary);
  text-decoration: none; padding: .15rem 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.web-source-item:hover { text-decoration: underline; }

/* ── Owner Dashboard ───────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: box-shadow var(--transition);
}
.product-card:hover { box-shadow: var(--shadow-md); }
.product-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }
.product-card-actions { display: flex; gap: .35rem; }
.manual-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: .75rem;
}
.manual-upload-area:hover { border-color: var(--primary); background: var(--primary-lt); }
.manual-upload-area.has-manual { border-style: solid; border-color: var(--success); background: #d1fae5; }
[data-theme="dark"] .manual-upload-area.has-manual { background: #064e3b; }

/* ── Admin Panel ───────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th {
  background: var(--bg-input);
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-input); }
.table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* ── Profile Page ──────────────────────────────────────────── */
.profile-page { max-width: 600px; margin: 0 auto; }
.profile-header {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.profile-avatar-wrap { position: relative; }
.profile-avatar-edit {
  position: absolute; bottom: 0; right: 0;
  width: 24px; height: 24px;
  background: var(--primary); color: #fff;
  border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
}

/* ── Logout Page ───────────────────────────────────────────── */
.logout-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  text-align: center;
}
.logout-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.logout-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
}
.logout-card h2 { margin-bottom: .75rem; }
.logout-card p  { margin-bottom: 2rem; }
.countdown-text { font-size: .85rem; color: var(--text-muted); margin-top: 1rem; }

/* ── Markdown rendered answers ─────────────────────────────── */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  color: inherit; margin-top: .75rem; margin-bottom: .35rem; font-weight: 600;
}
.message-bubble h1 { font-size: 1.1rem; }
.message-bubble h2 { font-size: 1rem; }
.message-bubble h3 { font-size: .95rem; }
.message-bubble ul, .message-bubble ol { padding-left: 1.25rem; margin: .5rem 0; }
.message-bubble li { margin-bottom: .2rem; }
.message-bubble code {
  background: rgba(0,0,0,.1); border-radius: 4px;
  padding: .1em .35em; font-size: .85em; font-family: monospace;
}
.message.user .message-bubble code { background: rgba(255,255,255,.2); }
.message-bubble pre {
  background: rgba(0,0,0,.12); border-radius: 6px;
  padding: .75rem 1rem; margin: .5rem 0;
  overflow-x: auto; font-size: .82em;
}
.message-bubble pre code { background: none; padding: 0; font-size: inherit; }
.message-bubble strong { font-weight: 600; }
.message-bubble p { color: inherit; margin-bottom: .35rem; }
.message-bubble p:last-child { margin-bottom: 0; }

/* ── Responsive Adjustments ─────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 220px; }
  .chat-layout { flex-direction: column; height: auto; }
  .product-panel { width: 100%; max-height: 260px; }
}
@media (max-width: 640px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 0; }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; flex-direction: column; gap: .2rem; padding: .75rem 1rem; font-size: .75rem; }
  .nav-item.active { border-left: none; border-bottom-color: var(--primary); }
  .hero h1 { font-size: 2rem; }
  .page-body { padding: 1rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
