/* =============================================================================
   AI Voice Bot — Admin Dashboard Styles
   admin/style.css
============================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:       #060b18;
  --bg2:      #0d1526;
  --bg3:      #121d35;
  --glass:    rgba(255,255,255,0.04);
  --border:   rgba(255,255,255,0.09);
  --text:     #e2e8f0;
  --muted:    #94a3b8;
  --dim:      #475569;
  --accent:   #6366f1;
  --glow:     rgba(99,102,241,0.3);
  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;
  --radius:   12px;
  --font:     'Inter', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }

/* ── Layout ── */
.admin-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { padding: 0 18px 20px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.sidebar-logo-title { font-size: 1rem; font-weight: 800; }
.sidebar-logo-title span { color: var(--accent); }
.sidebar-logo-sub { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; cursor: pointer; transition: background 0.2s;
  font-size: 0.85rem; font-weight: 500; color: var(--muted);
  border-left: 3px solid transparent; text-decoration: none;
}
.nav-item:hover { background: var(--glass); color: var(--text); }
.nav-item.active { border-left-color: var(--accent); background: rgba(99,102,241,0.08); color: var(--text); }
.nav-section-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); padding: 14px 18px 6px; }

/* ── Content ── */
.admin-content { flex: 1; overflow: auto; }
.content-header {
  padding: 20px 28px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(6,11,24,0.8); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
}
.content-header h1 { font-size: 1.1rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 10px; }
.content-body { padding: 24px 28px; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-color, var(--accent));
}
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.stat-change { font-size: 0.72rem; color: var(--success); margin-top: 4px; }

/* ── Section Headers ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }

/* ── Charts Row ── */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card {
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.chart-title { font-size: 0.82rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.chart-wrap { position: relative; height: 180px; }

/* ── Table ── */
.table-card {
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 24px;
}
.table-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.table-title { font-size: 0.85rem; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 16px; text-align: left; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr { transition: background 0.15s; cursor: pointer; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody td { padding: 11px 16px; font-size: 0.82rem; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 50px;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-positive { background: rgba(16,185,129,0.2); color: #10b981; }
.badge-negative { background: rgba(239,68,68,0.2);  color: #ef4444; }
.badge-neutral  { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-bot      { background: rgba(99,102,241,0.2);  color: #818cf8; }

/* ── Session Detail Modal ── */
.detail-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.detail-overlay.open { opacity: 1; pointer-events: all; }
.detail-modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 18px;
  width: 700px; max-width: 95vw; max-height: 88vh;
  display: flex; flex-direction: column; transform: scale(0.95); transition: transform 0.25s;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.detail-overlay.open .detail-modal { transform: scale(1); }
.detail-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.detail-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.detail-close { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; transition: color 0.2s; }
.detail-close:hover { color: var(--text); }

/* Conversation thread in modal */
.conv-turn { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.conv-user, .conv-bot {
  padding: 10px 14px; border-radius: 12px; font-size: 0.82rem; line-height: 1.5; max-width: 85%;
}
.conv-user { background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.25); align-self: flex-end; border-bottom-right-radius: 3px; }
.conv-bot  { background: rgba(255,255,255,0.04); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 3px; }
.conv-meta { font-size: 0.63rem; color: var(--dim); margin-top: 4px; }

/* ── Filters ── */
.filters-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-select, .filter-input {
  background: var(--glass); border: 1px solid var(--border);
  color: var(--text); font-size: 0.8rem; padding: 7px 12px; border-radius: 8px;
  outline: none; font-family: var(--font); transition: border-color 0.2s;
}
.filter-select:focus, .filter-input:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg2); }
.btn-refresh {
  background: var(--glass); border: 1px solid var(--border); color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 0.8rem; transition: all 0.2s;
}
.btn-refresh:hover { background: rgba(255,255,255,0.07); color: var(--text); border-color: var(--accent); }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 16px; }
.page-btn {
  background: var(--glass); border: 1px solid var(--border); color: var(--muted);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 0.78rem; transition: all 0.2s;
}
.page-btn:hover, .page-btn.active { background: rgba(99,102,241,0.15); border-color: var(--accent); color: var(--text); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

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

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Back button ── */
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--glass); border: 1px solid var(--border); color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 0.8rem;
  text-decoration: none; transition: all 0.2s;
}
.btn-back:hover { border-color: var(--accent); color: var(--text); }

/* ── Live dot ── */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 6px var(--success); animation: blink 1.5s infinite; display: inline-block; }
@keyframes blink { 50% { opacity: 0.3; } }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .charts-row { grid-template-columns: 1fr; }
  .content-body { padding: 16px; }
}
