/* ─── Tixora Design System ──────────────────────────────── */
:root {
  --accent: #00e59b;
  --accent-dim: #00c484;
  --accent-glow: rgba(0, 229, 155, 0.15);
  --bg: #0a0a0c;
  --bg-card: #111114;
  --bg-elevated: #18181c;
  --bg-input: #1a1a1f;
  --border: #2a2a30;
  --border-focus: #00e59b;
  --text: #e8e8ed;
  --text-muted: #8b8b95;
  --text-dim: #5a5a65;
  --red: #ff4d6a;
  --orange: #ff9f43;
  --blue: #5b8def;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ───────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ─── Nav ──────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
nav .nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
nav .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
nav .logo span { color: var(--accent); }
nav .nav-links { display: flex; gap: 8px; }
nav .nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
nav .nav-links a:hover,
nav .nav-links a.active {
  color: var(--text);
  background: var(--bg-elevated);
  text-decoration: none;
}
nav .nav-links a.active { color: var(--accent); }

/* ─── Hero ─────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 100px 24px 80px;
  max-width: 800px;
  margin: 0 auto;
}
.hero .badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--accent-glow);
  border: 1px solid rgba(0, 229, 155, 0.25);
  border-radius: 100px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}
.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent), #00b4d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 32px;
}
.hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .trust {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0c;
}
.btn-primary:hover { background: var(--accent-dim); text-decoration: none; }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-dim); text-decoration: none; }
.btn-danger { background: rgba(255,77,106,0.15); color: var(--red); border: 1px solid rgba(255,77,106,0.25); }
.btn-danger:hover { background: rgba(255,77,106,0.25); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Features Grid ────────────────────────────────────── */
.features {
  padding: 80px 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.features h2 {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}
.features .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 48px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--accent); }
.feature-card .icon {
  font-size: 28px;
  margin-bottom: 16px;
}
.feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.feature-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── How It Works ─────────────────────────────────────── */
.how-it-works {
  padding: 80px 24px;
  max-width: 800px;
  margin: 0 auto;
}
.how-it-works h2 {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 48px;
}
.steps { display: flex; flex-direction: column; gap: 32px; }
.step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.step-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(0,229,155,0.3);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}
.step h3 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.step p { color: var(--text-muted); font-size: 14px; }

/* ─── Page Content ─────────────────────────────────────── */
.page { display: none; padding: 32px 0; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
}

/* ─── Cards ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

/* ─── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 100px; }

/* ─── Stat Cards ───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card.resolved .stat-value { color: var(--accent); }
.stat-card.escalated .stat-value { color: var(--orange); }
.stat-card.open .stat-value { color: var(--blue); }
.stat-card.rate .stat-value { color: var(--accent); }

/* ─── Tickets List ─────────────────────────────────────── */
.ticket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.ticket-item:hover { border-color: var(--accent); }
.ticket-item .ticket-info { flex: 1; }
.ticket-item .ticket-subject {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}
.ticket-item .ticket-meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── Status Badges ────────────────────────────────────── */
.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-open { background: rgba(91,141,239,0.15); color: var(--blue); }
.badge-in_progress { background: rgba(255,159,67,0.15); color: var(--orange); }
.badge-resolved { background: rgba(0,229,155,0.15); color: var(--accent); }
.badge-escalated { background: rgba(255,77,106,0.15); color: var(--red); }

/* ─── Ticket Detail ────────────────────────────────────── */
.ticket-detail { display: none; }
.ticket-detail.active { display: block; }
.ticket-detail .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  cursor: pointer;
}
.ticket-detail .back-link:hover { color: var(--accent); }

.response-item {
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border-left: 3px solid var(--accent);
}
.response-item.manual { border-left-color: var(--blue); }
.response-item .response-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.response-item .response-content {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ─── Knowledge Docs ───────────────────────────────────── */
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.doc-item .doc-info h4 { font-size: 15px; font-weight: 600; }
.doc-item .doc-info p { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ─── Modal ────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ─── Empty State ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ─── Loading ──────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-success { background: rgba(0,229,155,0.15); color: var(--accent); border: 1px solid rgba(0,229,155,0.3); }
.toast-error { background: rgba(255,77,106,0.15); color: var(--red); border: 1px solid rgba(255,77,106,0.3); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Chart (simple bar) ───────────────────────────────── */
.chart-container { margin-top: 32px; }
.chart-container h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.bar-chart { display: flex; gap: 4px; align-items: flex-end; height: 160px; padding: 0 4px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
  width: 100%;
  max-width: 32px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s;
}
.bar.resolved { background: var(--accent); }
.bar.escalated { background: var(--orange); }
.bar-label { font-size: 10px; color: var(--text-dim); }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 60px 16px 40px; }
  .hero h1 { font-size: 28px; }
  .features, .how-it-works { padding: 40px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; }
  nav .nav-links a { padding: 8px 10px; font-size: 12px; }
}
