/* =============================================================================
   EPOPSHI — styles.css
   Dark theme. Clean. Functional over decorative.
   ============================================================================= */

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --bg-2:        #161b27;
  --bg-3:        #1e2535;
  --border:      #2a3347;
  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #64748b;
  --accent:      #f97316;   /* Epopshi orange — hoopoe crest */
  --accent-dim:  #7c3500;
  --green:       #4ade80;
  --red:         #f87171;
  --yellow:      #facc15;
  --blue:        #60a5fa;
  --radius:      8px;
  --radius-sm:   4px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

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

.hidden { display: none !important; }

/* ── Auth Screen ───────────────────────────────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-mark { font-size: 28px; color: var(--accent); }
.logo-text  { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }

.auth-tagline {
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 28px;
}

.tab-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.tab.active {
  background: var(--bg-3);
  color: var(--text);
  font-weight: 600;
}

.auth-box input {
  width: 100%;
  display: block;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.auth-box input:focus { border-color: var(--accent); }

/* ── App Shell ─────────────────────────────────────────────────────────────── */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.nav-links { list-style: none; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-2);
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-link:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--bg-3); color: var(--accent); font-weight: 600; }

.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-email {
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main Content ──────────────────────────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--bg);
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ── Breadcrumb ────────────────────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.bc-link { color: var(--accent); cursor: pointer; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: var(--text-3); }
.bc-current { color: var(--text-2); }

/* ── Stat Cards ────────────────────────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

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

.stat-card-warn { border-color: var(--red); }

.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }

/* ── Drill Cards ───────────────────────────────────────────────────────────── */
.drill-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.drill-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.drill-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.drill-card-title { font-weight: 600; margin-bottom: 6px; text-transform: capitalize; }
.drill-card-meta  { font-size: 12px; color: var(--text-2); }

/* ── Section Title ─────────────────────────────────────────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

/* ── Dashboard Toolbar ─────────────────────────────────────────────────────── */
.dashboard-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.date-range-picker { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }

.range-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}

.range-btn:hover  { background: var(--bg-3); }
.range-btn.active { background: var(--bg-3); color: var(--accent); font-weight: 600; }

/* ── Calls Table ───────────────────────────────────────────────────────────── */
.calls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.calls-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.calls-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-row { cursor: pointer; transition: background 0.1s; }
.call-row:hover td { background: var(--bg-2); }

.cell-time  { color: var(--text-3); white-space: nowrap; }
.cell-prompt { color: var(--text-2); }

/* ── Status Badges ─────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-success { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.status-error   { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.status-partial { background: rgba(250, 204, 21, 0.15);  color: var(--yellow); }

/* ── Provider Cards ────────────────────────────────────────────────────────── */
.providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.provider-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.provider-name { font-weight: 600; font-size: 15px; }

.provider-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.provider-badge.openai    { background: rgba(16,163,127,0.2); color: #10a37f; }
.provider-badge.anthropic { background: rgba(210,137,93,0.2); color: #d2895d; }
.provider-badge.gemini    { background: rgba(66,133,244,0.2); color: #4285f4; }
.provider-badge.grok      { background: rgba(255,255,255,0.1); color: var(--text-2); }

.provider-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
}

.provider-key   { color: var(--text-3); font-family: monospace; }
.status-active  { color: var(--green); }
.status-revoked { color: var(--text-3); }

.provider-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.provider-last-used { color: var(--text-3); }

/* ── Feed Toolbar ──────────────────────────────────────────────────────────── */
.feed-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.feed-search {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.feed-search:focus { border-color: var(--accent); }

.feed-toolbar select {
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover    { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 8px 16px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  padding: 6px 12px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.btn-ghost:hover { background: var(--bg-3); color: var(--text); }

.btn-danger {
  padding: 9px 18px;
  background: rgba(248,113,113,0.15);
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover { background: rgba(248,113,113,0.25); }

.btn-danger-sm {
  padding: 4px 10px;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.btn-danger-sm:hover { background: rgba(248,113,113,0.1); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  min-width: 440px;
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
}

#modal-box h2 { font-size: 17px; font-weight: 700; margin-bottom: 20px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── Form Groups ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }

/* ── Call Detail ───────────────────────────────────────────────────────────── */
.call-detail { display: flex; flex-direction: column; gap: 12px; }

.detail-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 80px;
  padding-top: 2px;
}

.detail-value { color: var(--text); font-size: 13px; }
.detail-section { display: flex; flex-direction: column; gap: 6px; }

.detail-pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.error-msg    { color: var(--red); font-size: 13px; margin: 8px 0; }
.error-text   { color: var(--red); }
.warning-text { color: var(--yellow); font-size: 13px; margin: 8px 0; }
.loading      { color: var(--text-3); font-size: 13px; padding: 20px 0; }
.muted        { color: var(--text-3); }

.empty-state {
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
  padding: 48px 20px;
  line-height: 1.8;
}

.load-more {
  display: block;
  width: 100%;
  margin-top: 16px;
  text-align: center;
}

/* ── Logo Images ───────────────────────────────────────────────────────────── */
.logo-img {
  width: 100px;
  height: auto;
  display: block;
  margin: 0 auto 4px;
  /* Logo has white bg — clip to just the icon area */
  border-radius: 50%;
  background: transparent;
}

.logo-img-sidebar {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Auth logo centered */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

/* ── Logo Images (override) ────────────────────────────────────────────────── */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.logo-img {
  width: 102px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 0;
  background: transparent;
  mix-blend-mode: screen;
}

.logo-img-sidebar {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
  mix-blend-mode: screen;
}