@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-deep: #0a0812;
  --bg-surface: #13101f;
  --bg-card: #1a1528;
  --bg-card-hover: #211a33;
  --bg-input: #16122a;
  --purple-dim: #2d1f4e;
  --purple-mid: #4a2d7a;
  --purple-bright: #7c4dff;
  --purple-glow: #9c6fff;
  --purple-soft: #b794f6;
  --accent-green: #4ade80;
  --accent-red: #f87171;
  --accent-yellow: #fbbf24;
  --accent-blue: #60a5fa;
  --text-primary: #e8e0f0;
  --text-secondary: #9a8fb8;
  --text-muted: #665e80;
  --border: #2a2240;
  --border-focus: #4a2d7a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(10, 8, 18, 0.6);
  --shadow-glow: 0 0 30px rgba(124, 77, 255, 0.15);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(74, 45, 122, 0.12) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(124, 77, 255, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ===== LOGIN ===== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 380px;
  box-shadow: var(--shadow), var(--shadow-glow);
  animation: fadeUp 0.6s ease-out;
}

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

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple-bright), var(--purple-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  transition: border var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--purple-bright);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

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

.btn-primary {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--purple-mid), var(--purple-bright));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 77, 255, 0.35);
}

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

.login-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--accent-red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ===== LAYOUT ===== */
.app { display: none; position: relative; z-index: 1; }

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar-brand {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple-bright), var(--purple-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-nav {
  display: flex;
  gap: 4px;
}

.topbar-nav button {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.topbar-nav button:hover { color: var(--text-primary); background: var(--bg-card); }
.topbar-nav button.active {
  color: var(--purple-bright);
  background: var(--purple-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.btn-logout {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.main { padding: 32px; max-width: 1200px; margin: 0 auto; }

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--purple-dim);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, var(--text-primary), var(--purple-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== TABLE ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover, .filter-btn.active {
  border-color: var(--purple-bright);
  color: var(--purple-bright);
  background: var(--purple-dim);
}

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

table { width: 100%; border-collapse: collapse; }

th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-align: left;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(42, 34, 64, 0.5);
  vertical-align: middle;
}

tr { transition: background var(--transition); }
tr:hover td { background: var(--bg-card-hover); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-green { background: rgba(74, 222, 128, 0.12); color: var(--accent-green); }
.badge-red { background: rgba(248, 113, 113, 0.12); color: var(--accent-red); }
.badge-yellow { background: rgba(251, 191, 36, 0.12); color: var(--accent-yellow); }
.badge-blue { background: rgba(96, 165, 250, 0.12); color: var(--accent-blue); }
.badge-purple { background: rgba(124, 77, 255, 0.12); color: var(--purple-glow); }

.sentiment-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.sentiment-happy { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.sentiment-neutral { background: var(--accent-yellow); box-shadow: 0 0 6px var(--accent-yellow); }
.sentiment-frustrated { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }

.caller-name { font-weight: 500; }
.caller-number { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

/* ===== CONTACTS ===== */
.search-box {
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  width: 280px;
  outline: none;
  transition: border var(--transition);
}

.search-box:focus { border-color: var(--purple-bright); }

/* ===== CALL DETAIL MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 8, 18, 0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow), 0 0 60px rgba(124, 77, 255, 0.1);
  animation: fadeUp 0.3s ease-out;
}

.modal-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--transition);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-surface); }

.modal-body { padding: 20px 28px 28px; }

.modal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.meta-item label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.meta-item span {
  font-size: 14px;
  color: var(--text-primary);
}

.transcript-box {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

.transcript-line { margin-bottom: 8px; }
.transcript-nova { color: var(--purple-soft); }
.transcript-user { color: var(--text-primary); }
.transcript-role {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 8px;
}

/* ===== PAGES ===== */
.page { display: none; }
.page.active { display: block; animation: fadeUp 0.3s ease-out; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 16px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-box { width: 90%; padding: 32px 24px; }
  .modal { width: 95%; }
}

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--purple-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-mid); }

/* ===== UTILITY CLASSES (replaces inline styles) ===== */
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-mono-sm { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.font-mono-xs { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted-color { color: var(--text-muted); }
.text-secondary-color { color: var(--text-secondary); }
.text-nowrap { white-space: nowrap; }
.max-w-200 { max-width: 200px; }
.cursor-pointer { cursor: pointer; }
.modal-title-size { font-size: 16px; font-weight: 600; }
.modal-subtitle-style { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-family: 'JetBrains Mono', monospace; }
.meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); display: block; margin-bottom: 8px; }
.summary-text { font-size: 14px; line-height: 1.5; margin-bottom: 20px; color: var(--text-secondary); }
.summary-cell { max-width: 200px; color: var(--text-secondary); font-size: 13px; }
.transcript-empty { color: var(--text-muted); }
