/* public/css/app.css */

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

:root {
  --bg: #0a0a0b;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-3: #222226;
  --border: #2a2a2e;
  --border-light: #333338;

  --text: #f0f0f2;
  --text-2: #a0a0aa;
  --text-3: #666670;

  --accent: #e8ff47;       /* Vulture yellow-green */
  --accent-dim: rgba(232,255,71,0.12);
  --accent-hover: #d4eb3a;

  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.12);

  --sidebar-w: 220px;
  --topbar-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;

  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  padding: 20px 12px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition: all 0.15s;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logout-btn { color: var(--text-3); }
.logout-btn:hover { color: var(--red); background: var(--red-dim); }

.sidebar-client {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 4px;
}

.client-avatar {
  width: 32px; height: 32px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  flex-shrink: 0;
}

.client-name { font-size: 12px; font-weight: 500; color: var(--text); }
.client-plan {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Main ────────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

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

.topbar-date {
  font-size: 12px;
  color: var(--text-3);
  font-family: 'DM Mono', monospace;
}

.content { padding: 28px; flex: 1; }

/* ─── Stat Cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-light); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-icon svg { width: 18px; height: 18px; }

.stat-icon.yellow { background: var(--accent-dim); color: var(--accent); }
.stat-icon.green  { background: var(--green-dim);  color: var(--green); }
.stat-icon.blue   { background: var(--blue-dim);   color: var(--blue); }
.stat-icon.amber  { background: var(--amber-dim);  color: var(--amber); }
.stat-icon.red    { background: var(--red-dim);    color: var(--red); }

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
}

/* ─── Tables ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.card-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.card-link:hover { text-decoration: underline; }

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

th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ─── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-new      { background: var(--blue-dim);   color: var(--blue); }
.badge-active   { background: var(--green-dim);  color: var(--green); }
.badge-qualified{ background: var(--accent-dim); color: var(--accent); }
.badge-pending  { background: var(--amber-dim);  color: var(--amber); }
.badge-paid     { background: var(--green-dim);  color: var(--green); }
.badge-overdue  { background: var(--red-dim);    color: var(--red); }
.badge-complete { background: var(--surface-3);  color: var(--text-2); }
.badge-draft    { background: var(--surface-3);  color: var(--text-3); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0b;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn svg { width: 14px; height: 14px; }

/* ─── Two-col grid ────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ─── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(232,255,71,0.06) 0%, transparent 60%);
}

.login-box {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--accent);
}

.login-title {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-sub { color: var(--text-3); margin-bottom: 28px; font-size: 14px; }

/* ─── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.error-msg {
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ─── Conversation view ───────────────────────────────────────── */
.conv-thread { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.msg-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

.msg-bubble.outbound {
  background: var(--accent-dim);
  border: 1px solid rgba(232,255,71,0.2);
  color: var(--text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg-bubble.inbound {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 10px;
  color: var(--text-3);
  font-family: 'DM Mono', monospace;
  margin-top: 2px;
  display: block;
}

/* ─── Utilities ───────────────────────────────────────────────── */
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: 12px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-3); }
.font-mono { font-family: 'DM Mono', monospace; }
.font-bold { font-weight: 700; }

/* ─── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}
.empty-state svg { width: 40px !important; height: 40px !important; max-width: 40px !important; margin: 0 auto 12px; opacity: 0.3; display: block; }
.empty-state p { font-size: 14px; }

/* Fix oversized SVG icons */
.empty-state svg {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  display: block;
  margin: 0 auto 12px;
  opacity: 0.3;
}
.stat-icon svg {
  width: 18px !important;
  height: 18px !important;
}
.nav-item svg {
  width: 16px !important;
  height: 16px !important;
}
