/* Darbužurnalas.lt admin dashboard — dark Linear-inspired theme */

:root {
  --bg: #0e1116;
  --surface: #1a1f28;
  --surface-2: #1f2530;
  --border: #2a3140;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --accent: #e2452f;
  --accent-hover: #c9381e;
  --success: #4ade80;
  --warning: #facc15;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Top nav ─────────────────────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  background: rgba(14, 17, 22, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}
.topnav-logo {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.topnav-logo-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 2px;
}
.topnav-links {
  display: flex;
  gap: 4px;
}
.topnav-links a {
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.topnav-links a:hover { background: var(--surface-2); color: var(--text); }
.topnav-links a.active { background: var(--surface); color: var(--text); }
.topnav-user {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}
.topnav-user-email {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}
.card-title { font-size: 13px; color: var(--muted); margin: 0 0 8px 0; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.card-section-title { font-size: 15px; font-weight: 600; margin: 0 0 14px 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px 22px; }
.stat-card .stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; margin-bottom: 10px; }
.stat-card .stat-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }
.btn-secondary { border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: #3a4252; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991414; }
.btn-icon {
  padding: 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.btn-icon:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-icon.btn-icon-danger:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

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

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.input, .select, textarea.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(226, 69, 47, 0.15);
}
.input::placeholder { color: #5b6373; }
textarea.input { resize: vertical; min-height: 80px; }

.label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-row { margin-bottom: 14px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 160px; }
.filter-bar .search { min-width: 240px; }
.filter-bar-spacer { flex: 1; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data thead th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { display: flex; gap: 6px; justify-content: flex-end; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12.5px; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge.muted { background: var(--border); color: var(--muted); }
.badge.success { background: #14532d; color: var(--success); }
.badge.warning { background: #422006; color: var(--warning); }
.badge.accent { background: #7f1d1d; color: #fca5a5; }
.badge.info { background: #1e3a8a; color: #93c5fd; }
.badge.purple { background: #4c1d95; color: #c4b5fd; }

/* Hot dot */
.hot-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(226, 69, 47, 0.18);
}

/* ─── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.empty-state .icon { color: var(--muted); margin-bottom: 16px; }
.empty-state h3 { margin: 0 0 8px 0; font-weight: 600; font-size: 16px; }
.empty-state p { color: var(--muted); margin: 0 0 20px 0; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title { font-size: 16px; font-weight: 600; margin: 0; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ─── Confirm dialog (small) ─────────────────────────────────────────────── */
.confirm-dialog { max-width: 420px; }
.confirm-dialog p { margin: 0 0 8px 0; color: var(--muted); }

/* ─── Login page ─────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-weight: 600;
  font-size: 17px;
}
.login-logo .dot { width: 12px; height: 12px; background: var(--accent); border-radius: 3px; }
.login-title { font-size: 18px; font-weight: 600; margin: 0 0 6px 0; }
.login-sub { color: var(--muted); margin: 0 0 28px 0; font-size: 13.5px; }
.btn-google {
  width: 100%;
  background: #fff;
  color: #1f2937;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}
.btn-google:hover { background: #f5f5f5; color: #1f2937; }
.login-footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}
.login-error {
  background: rgba(226, 69, 47, 0.12);
  border: 1px solid rgba(226, 69, 47, 0.4);
  color: #fca5a5;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  text-align: left;
}

/* ─── Tooltip (?) ─────────────────────────────────────────────────────────── */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  position: relative;
}
.help-tip:hover .help-tip-body { display: block; }
.help-tip-body {
  display: none;
  position: absolute;
  top: 24px;
  left: 0;
  background: #06080c;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  width: 280px;
  font-size: 12px;
  font-weight: 400;
  z-index: 50;
  text-align: left;
  line-height: 1.5;
}

/* ─── Skambutis (call detail) ─────────────────────────────────────────────── */
.call-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .call-grid { grid-template-columns: 1fr; }
}
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--muted); }
.info-row .v { text-align: right; max-width: 60%; word-break: break-word; }

audio { width: 100%; margin-bottom: 16px; }

.transcript-list { display: flex; flex-direction: column; gap: 10px; }
.transcript-turn { display: flex; }
.transcript-turn.user { justify-content: flex-start; }
.transcript-turn.assistant, .transcript-turn.model { justify-content: flex-end; }
.transcript-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
}
.transcript-turn.user .transcript-bubble {
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 2px;
}
.transcript-turn.assistant .transcript-bubble,
.transcript-turn.model .transcript-bubble {
  background: rgba(226, 69, 47, 0.85);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.transcript-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}
.transcript-turn.user .transcript-time { text-align: left; padding-left: 4px; }
.transcript-turn.assistant .transcript-time,
.transcript-turn.model .transcript-time { text-align: right; padding-right: 4px; }

.fn-call {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.fn-call .fn-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--warning); }
.fn-call summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 6px 0; }
.fn-call pre { background: #06080c; padding: 10px; border-radius: 4px; font-size: 11.5px; overflow-x: auto; margin: 4px 0; color: var(--text); }

/* ─── Hot leads ──────────────────────────────────────────────────────────── */
.hot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.hot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  position: relative;
}
.hot-card .hot-dot-corner { position: absolute; top: 16px; right: 16px; }
.hot-card .name { font-weight: 600; font-size: 15px; margin: 0 0 2px 0; padding-right: 24px; }
.hot-card .company { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.hot-card .contact-line { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.hot-card .signal { margin-bottom: 12px; }
.hot-card .summary {
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 14px;
}
.hot-card .timestamp { font-size: 11.5px; color: var(--muted); margin-bottom: 14px; }
.hot-card .actions { display: flex; gap: 8px; }

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.back-link {
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}
.back-link:hover { color: var(--text); }

.recording-row td {
  background: var(--bg);
  padding: 14px 16px;
  border-top: none;
}
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  z-index: 200;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 13.5px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--accent); }

.loader {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
