/* EverydayAI Admin Panel — Dark theme */

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

:root {
  --bg:       #0f172a;
  --bg2:      #1e293b;
  --bg3:      #334155;
  --border:   #475569;
  --text:     #e2e8f0;
  --text2:    #94a3b8;
  --blue:     #3b82f6;
  --blue-d:   #1e40af;
  --green:    #22c55e;
  --yellow:   #eab308;
  --red:      #ef4444;
  --purple:   #a855f7;
  --radius:   8px;
  --sidebar:  240px;
}

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

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

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; position: fixed; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 16px;
  border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px;
}
.brand-icon { font-size: 20px; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius); color: var(--text2); font-weight: 500; transition: all .15s;
}
.nav-link:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav-link.nav-active { background: var(--blue-d); color: #fff; }
.nav-icon { font-size: 16px; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.admin-user { color: var(--text2); font-size: 13px; }
.logout-link { color: var(--text2); font-size: 13px; }
.logout-link:hover { color: var(--red); }

/* ── Main ── */
.main { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; }
.page-header { padding: 24px 28px 0; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.page-title { font-size: 22px; font-weight: 700; }
.content { padding: 24px 28px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin: 16px 28px 0; font-size: 14px; }
.alert-success { background: #14532d; border: 1px solid #16a34a; color: #86efac; }
.alert-error   { background: #7f1d1d; border: 1px solid #ef4444; color: #fca5a5; }

/* ── Cards / panels ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); }
.card-body { padding: 20px; }

/* ── Stats row ── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg3); padding: 10px 14px; text-align: left; font-size: 12px;
     text-transform: uppercase; letter-spacing: .05em; color: var(--text2); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg2); }

/* ── Status badges ── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-new           { background: #1e3a5f; color: #93c5fd; }
.badge-game_plan_sent { background: #1a3a2a; color: #6ee7b7; }
.badge-won           { background: #1a3a1a; color: #86efac; }
.badge-lost          { background: #3a1a1a; color: #fca5a5; }

/* ── Buttons ── */
.btn { display: inline-block; padding: 8px 18px; border-radius: var(--radius); font-size: 14px;
       font-weight: 600; cursor: pointer; border: none; transition: opacity .15s; }
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-green   { background: #16a34a; color: #fff; }
.btn-red     { background: #dc2626; color: #fff; }
.btn-ghost   { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text2); font-weight: 500; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
textarea { resize: vertical; min-height: 100px; }

/* ── Filter bar ── */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar select, .filter-bar input { width: auto; }

/* ── Lead detail ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-section { margin-bottom: 24px; }
.detail-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
                      color: var(--text2); margin-bottom: 12px; padding-bottom: 6px;
                      border-bottom: 1px solid var(--border); }
.detail-row { display: flex; padding: 6px 0; gap: 12px; }
.detail-key { color: var(--text2); min-width: 140px; font-size: 13px; }
.detail-val { color: var(--text); }

/* ── Game plan preview ── */
.gp-preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
               padding: 20px; white-space: pre-wrap; font-family: 'Courier New', monospace;
               font-size: 13px; line-height: 1.7; max-height: 600px; overflow-y: auto; }

/* ── Login page ── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
              padding: 36px; width: 100%; max-width: 380px; }
.login-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-box p  { color: var(--text2); margin-bottom: 24px; font-size: 14px; }
.login-error  { background: #7f1d1d; border: 1px solid var(--red); color: #fca5a5;
                 padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 5px 12px; border-radius: var(--radius); font-size: 13px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
}
.pagination a:hover { background: var(--bg3); text-decoration: none; }
.pagination .current { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ── Misc ── */
.text-muted  { color: var(--text2); }
.text-sm     { font-size: 12px; }
.mt-4        { margin-top: 16px; }
.mb-4        { margin-bottom: 16px; }
.flex        { display: flex; }
.gap-2       { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
