/* ═══════════════════════════════════════════
   AXYOM Customer Dashboard — Design System
   Mirrors admin.css variables/patterns
   ═══════════════════════════════════════════ */

:root {
  --teal:       #00B2A0;
  --teal-dim:   #009A8A;
  --teal-glow:  rgba(0, 178, 160, 0.25);
  --teal-ghost: rgba(0, 178, 160, 0.08);
  --teal-border:rgba(0, 178, 160, 0.15);
  --dark:       #004C44;
  --void:       #010B13;
  --surface:    #0A1520;
  --surface-2:  #0F1D2B;
  --surface-3:  #142636;
  --border:     rgba(255, 255, 255, 0.06);
  --border-h:   rgba(255, 255, 255, 0.12);
  --text:       #E8ECF1;
  --text-dim:   #8899AA;
  --text-muted: #556677;
  --red:        #FF4D6A;
  --red-bg:     rgba(255, 77, 106, 0.1);
  --green:      #00D4AA;
  --green-bg:   rgba(0, 212, 170, 0.1);
  --orange:     #FFB347;
  --orange-bg:  rgba(255, 179, 71, 0.1);
  --radius:     12px;
  --radius-sm:  8px;
  --radius-xs:  6px;
  --shadow:     0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg:  0 12px 48px rgba(0, 0, 0, 0.5);
  --font:       'DM Sans', -apple-system, system-ui, sans-serif;
  --mono:       'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --transition: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--void);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

::selection { background: var(--teal); color: var(--void); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal-dim); }

/* ═══ Login / Register ═══ */

.login-page { background: var(--void); }

.login-scene {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 500px; height: 500px;
  background: var(--dark);
  top: -20%; left: -10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 400px; height: 400px;
  background: var(--teal);
  bottom: -15%; right: -5%;
  opacity: 0.15;
  animation-delay: -7s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: var(--teal-dim);
  top: 50%; left: 60%;
  opacity: 0.08;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-h);
  border-radius: 20px;
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.login-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.login-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}

.login-footer a:hover { text-decoration: underline; }

.error-msg {
  color: var(--red);
  font-size: 0.82rem;
  min-height: 18px;
  margin-top: 4px;
}

/* ═══ Inputs ═══ */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

input, select, textarea {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-h);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

input::placeholder { color: var(--text-muted); }

input[type="color"] {
  padding: 4px;
  height: 42px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ═══ Buttons ═══ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--teal), var(--teal-dim));
  color: var(--void);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0, 178, 160, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 178, 160, 0.4);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary.full { width: 100%; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-h);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-ghost:hover {
  border-color: var(--teal-border);
  color: var(--teal);
  background: var(--teal-ghost);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 77, 106, 0.2);
  border-radius: var(--radius-xs);
  background: var(--red-bg);
  color: var(--red);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-danger:hover { background: rgba(255, 77, 106, 0.18); }

/* Modal backdrop */
.modal-backdrop { display: none; }

/* ═══ Nav ═══ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  background: rgba(10, 21, 32, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-pill {
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-h);
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--surface-2);
  font-weight: 500;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-h);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-nav:hover { color: var(--red); border-color: rgba(255, 77, 106, 0.3); }

/* ═══ Dashboard layout ═══ */

.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ═══ Stats grid ═══ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--teal-border); }

.stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-ghost);
  border-radius: var(--radius-sm);
  color: var(--teal);
  flex-shrink: 0;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

/* ═══ Section header ═══ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

/* ═══ Card ═══ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card-body {
  padding: 24px;
}

/* ═══ Website card ═══ */

.website-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.website-card:hover { border-color: var(--teal-border); }

.website-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  cursor: pointer;
  user-select: none;
  gap: 12px;
  flex-wrap: wrap;
}

.website-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.website-domain {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--mono);
}

.website-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.website-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.website-panel {
  display: none;
  border-top: 1px solid var(--border);
}

.website-panel.open { display: block; }

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  gap: 0;
}

.panel-tab {
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.panel-tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.panel-tab:hover:not(.active) { color: var(--text-dim); }

.panel-content {
  padding: 24px;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ═══ Pill badges ═══ */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red   { background: var(--red-bg); color: var(--red); }
.pill-orange{ background: var(--orange-bg); color: var(--orange); }
.pill-teal  { background: var(--teal-ghost); color: var(--teal); }
.pill-muted { background: var(--surface-3); color: var(--text-muted); }

/* ═══ Stats mini row ═══ */

.mini-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mini-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

/* ═══ Widget config form ═══ */

.widget-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .input-group { flex: 1; min-width: 160px; }

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pos-btns {
  display: flex;
  gap: 8px;
}

.pos-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-h);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
}

.pos-btn.active {
  border-color: var(--teal-border);
  background: var(--teal-ghost);
  color: var(--teal);
}

.save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.save-status {
  font-size: 0.82rem;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.3s;
}

.save-status.visible { opacity: 1; }

/* ═══ Embed code ═══ */

.embed-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.7;
}

.embed-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ═══ Conversations / chat history ═══ */

.session-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
}

.session-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-dim);
  user-select: none;
}

.session-header:hover { background: var(--surface-3); }

.session-messages {
  display: none;
  padding: 0 14px 14px;
}

.session-messages.open { display: block; }

.chat-bubble {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  line-height: 1.5;
  max-width: 85%;
  margin-bottom: 6px;
}

.chat-bubble.user {
  background: var(--teal-ghost);
  color: var(--text);
  border: 1px solid var(--teal-border);
  margin-left: auto;
  text-align: right;
}

.chat-bubble.assistant {
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ═══ Billing card ═══ */

.plan-display {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.plan-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.usage-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.usage-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.usage-bar-track {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--teal);
  transition: width 0.5s ease;
}

.usage-bar-fill.warn { background: var(--orange); }
.usage-bar-fill.over { background: var(--red); }

/* ═══ Account section ═══ */

.account-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 480px;
}

/* ═══ Top messages ═══ */

.top-msgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-msg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}

.top-msg-row:last-child { border-bottom: none; }

.top-msg-count {
  min-width: 28px;
  height: 22px;
  background: var(--teal-ghost);
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--teal);
  flex-shrink: 0;
}

.top-msg-text {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══ Empty states ═══ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.empty-icon {
  opacity: 0.4;
  color: var(--teal);
}

/* ═══ Loader ═══ */

.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-h);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ═══ Alert banner ═══ */

.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid;
}

.alert-warn {
  background: var(--orange-bg);
  border-color: rgba(255, 179, 71, 0.2);
  color: var(--orange);
}

.alert-error {
  background: var(--red-bg);
  border-color: rgba(255, 77, 106, 0.2);
  color: var(--red);
}

.alert-success {
  background: var(--green-bg);
  border-color: rgba(0, 212, 170, 0.2);
  color: var(--green);
}

/* ═══ Retrain progress ═══ */

.retrain-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-bar-wrap {
  flex: 1;
  min-width: 120px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--teal);
  transition: width 0.4s;
}

/* ═══ Responsive ═══ */

@media (max-width: 700px) {
  .nav { padding: 0 16px; }
  .dashboard { padding: 20px 16px 60px; }
  .login-card { padding: 36px 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .panel-tabs { overflow-x: auto; }
  .form-row { flex-direction: column; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .mini-stats { gap: 14px; }
}
