/* ============================================================
   Dashboard + Auth stylesheet
   Reuses the same neubrutalist black/white design tokens as
   main.css (hard borders, offset shadows) for a consistent look.
   ============================================================ */

:root{
  --dash-bg: #f0f2f5;
  --dash-card: #ffffff;
  --dash-border: #0a0a0f;
  --dash-text: #0a0a0f;
  --dash-muted: #64748b;
  --dash-green: #16a34a;
  --dash-green-bg: #dcfce7;
  --dash-red: #dc2626;
  --dash-red-bg: #fee2e2;
  --dash-yellow: #b45309;
  --dash-yellow-bg: #fef3c7;
  --dash-shadow: 4px 4px 0 var(--dash-border);
}
html[data-theme="dark"]{
  --dash-bg: #0f1115;
  --dash-card: #171a21;
  --dash-border: #2a2e37;
  --dash-text: #f1f5f9;
  --dash-muted: #94a3b8;
}
html[data-theme="dark"] .dash-shell{ background: var(--dash-bg); }
html[data-theme="dark"] .dash-card, html[data-theme="dark"] .auth-card{ background: var(--dash-card); color: var(--dash-text); }
html[data-theme="dark"] .dash-sidebar{ background: var(--dash-card); border-color: var(--dash-border); }
html[data-theme="dark"] body{ background: var(--dash-bg); color: var(--dash-text); }

body.dash-body, body.auth-body{ background: var(--dash-bg); font-family: var(--font, 'Space Grotesk', sans-serif); }

/* ── Dashboard shell ── */
.dash-shell{ display:flex; min-height:100vh; background: var(--dash-bg); }
.dash-sidebar{
  width: 240px; flex-shrink:0; background:#fff; border-right:2.5px solid var(--dash-border);
  display:flex; flex-direction:column; padding:20px 16px; position:sticky; top:0; height:100vh; overflow-y:auto;
}
.dash-logo{ display:flex; align-items:center; gap:8px; background:var(--dash-border); color:#fff; font-weight:800; font-size:14px; letter-spacing:.03em; padding:9px 14px; border-radius:8px; width:fit-content; text-decoration:none; margin-bottom:24px; }
.dash-nav{ display:flex; flex-direction:column; gap:2px; flex:1; }
.dash-nav-link{ display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:8px; color:var(--dash-text); text-decoration:none; font-size:14px; font-weight:500; transition:background .12s; }
.dash-nav-link i{ width:18px; text-align:center; font-size:14px; color:var(--dash-muted); }
.dash-nav-link:hover{ background:var(--dash-bg); }
.dash-nav-link.active{ background:var(--dash-border); color:#fff; }
.dash-nav-link.active i{ color:#fff; }
.dash-nav-divider{ height:1px; background:#e2e8f0; margin:14px 0; }

.dash-theme-toggle{ display:flex; align-items:center; justify-content:space-between; gap:8px; border:2px solid var(--dash-border); border-radius:10px; padding:8px 12px; font-size:13px; font-weight:600; cursor:pointer; background:#fff; margin-bottom:12px; }
.dash-user-card{ display:flex; align-items:center; gap:10px; padding:10px; border-radius:10px; }
.dash-user-avatar{ width:34px; height:34px; border-radius:50%; background:var(--dash-bg); border:1.5px solid var(--dash-border); object-fit:cover; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex-shrink:0; }
.dash-user-name{ font-size:13px; font-weight:700; line-height:1.2; }
.dash-user-plan{ font-size:11px; color:var(--dash-muted); }

.dash-main{ flex:1; min-width:0; padding:32px 36px 60px; }
.dash-header{
  display:flex; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; gap:14px; margin-bottom:26px;
  background:#fff; border:2px solid var(--dash-border); border-radius:14px; padding:18px 22px; box-shadow: var(--dash-shadow);
}
.dash-title{ font-size:26px; font-weight:800; margin:0 0 4px; }
.dash-subtitle{ color:var(--dash-muted); font-size:14px; margin:0; }
.dash-mobile-toggle{ display:none; }

@media(max-width:575px){
  .dash-title{ font-size:21px; }
  .dash-header{ padding:14px 16px; }
  .dash-header > .dash-btn{ width:100%; justify-content:center; }
}

@media(max-width: 991px){
  .dash-sidebar{ position:fixed; left:-260px; z-index:1000; transition:left .2s; box-shadow:8px 0 30px rgba(0,0,0,.15); }
  .dash-sidebar.open{ left:0; }
  .dash-main{ padding:20px 16px 50px; }
  .dash-mobile-toggle{
    display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px;
    background:transparent; color: var(--dash-text); border:1.5px solid var(--dash-border); border-radius:9px;
    font-size:15px; transition: background .15s ease, border-color .15s ease;
  }
  .dash-mobile-toggle:hover{ background: var(--dash-bg); }
  .dash-mobile-toggle.is-open i::before{ content:"\f00d"; } /* fa-xmark, swapped in when sidebar is open */
  .dash-overlay{ display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:999; }
  .dash-overlay.open{ display:block; }
}

/* ── Cards ── */
.dash-card{ background:#fff; border:2.5px solid var(--dash-border); border-radius:14px; box-shadow: var(--dash-shadow); padding:20px; }
.dash-card-flat{ background:#fff; border:2px solid var(--dash-border); border-radius:12px; padding:18px; }

.stat-card{ background:#fff; border:2.5px solid var(--dash-border); border-radius:14px; box-shadow: var(--dash-shadow); padding:18px; }
.stat-card-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.stat-card-icon{ width:36px;height:36px;border-radius:9px;background:var(--dash-bg);border:1.5px solid var(--dash-border);display:grid;place-items:center;font-size:14px; }
.stat-card-value{ font-size:26px; font-weight:800; }
.stat-card-delta{ font-size:12px; font-weight:700; }
.stat-card-delta.up{ color: var(--dash-green); }
.stat-card-delta.down{ color: var(--dash-red); }

/* ── Badges ── */
.badge-pill{ display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:3px 10px; border-radius:99px; border:1.5px solid transparent; }
.badge-green{ background:var(--dash-green-bg); color:var(--dash-green); border-color:#bbf7d0; }
.badge-red{ background:var(--dash-red-bg); color:var(--dash-red); border-color:#fecaca; }
.badge-yellow{ background:var(--dash-yellow-bg); color:var(--dash-yellow); border-color:#fde68a; }
.badge-gray{ background:#f1f5f9; color:#64748b; border-color:#e2e8f0; }
.dot-badge{ display:inline-flex; align-items:center; gap:6px; font-size:13px; }
.dot-badge::before{ content:''; width:8px; height:8px; border-radius:50%; background: var(--dash-green); }

.method-tag{ font-family: var(--mono, monospace); font-size:11px; font-weight:800; padding:3px 9px; border-radius:6px; background:var(--dash-border); color:#fff; letter-spacing:.02em; min-width:52px; text-align:center; display:inline-block; }
.method-tag.err{ background: var(--dash-red); }

/* ── Table ── */
.dash-table{ width:100%; border-collapse:collapse; font-size:13.5px; }
.dash-table th{ text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--dash-muted); font-weight:700; padding:10px 12px; border-bottom:2px solid var(--dash-border); }
.dash-table td{ padding:12px; border-bottom:1.5px solid #eef0f3; vertical-align:middle; }
.dash-table tr:last-child td{ border-bottom:none; }
.dash-table-row-link{ cursor:pointer; transition: background .1s; }
.dash-table-row-link:hover{ background:var(--dash-bg); }

/* ── Buttons / forms (shared with auth) ── */
.dash-btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; font-weight:700; font-size:13.5px; padding:10px 18px; border-radius:9px; border:2px solid var(--dash-border); cursor:pointer; text-decoration:none; transition:.12s; }
.dash-btn-dark{ background:var(--dash-border); color:#fff; }
.dash-btn-dark:hover{ background:#000; color:#fff; }
.dash-btn-outline{ background:#fff; color:var(--dash-border); }
.dash-btn-outline:hover{ background:var(--dash-bg); }
.dash-btn-danger{ background:#fff; color:var(--dash-red); border-color:var(--dash-red); }
.dash-btn-danger:hover{ background:var(--dash-red-bg); }
.dash-btn-sm{ padding:6px 12px; font-size:12px; }
.dash-btn:disabled{ opacity:.5; cursor:not-allowed; }

.dash-field label{ font-size:13px; font-weight:600; margin-bottom:6px; display:block; }
.dash-field input, .dash-field textarea, .dash-field select{
  width:100%; border:2px solid #e2e8f0; border-radius:9px; padding:11px 12px; font-size:16px;
  background:#fff; transition:border-color .12s; -webkit-appearance:none; appearance:none;
}
.dash-field input:focus, .dash-field textarea:focus, .dash-field select:focus{ outline:none; border-color: var(--dash-border); box-shadow:0 0 0 3px rgba(10,10,15,.08); }
.dash-field-icon{ position:relative; }
.dash-field-icon i{ position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#94a3b8; font-size:13px; }
.dash-field-icon input{ padding-left:36px; padding-right:36px; }
.dash-field-icon .toggle-pw{ position:absolute; right:0; left:auto; top:0; bottom:0; width:42px; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.dash-field-icon .toggle-pw i{ position:static; transform:none; }

/* Any interactive element gets a visible focus ring for keyboard users */
.dash-btn:focus-visible, .dash-nav-link:focus-visible, .key-icon-btn:focus-visible,
.auth-btn-oauth:focus-visible, .otp-box:focus-visible, .switch input:focus-visible + .switch-track{
  outline:2.5px solid #2563eb; outline-offset:2px;
}

/* ── Tabs ── */
.dash-tabs{ display:flex; gap:6px; border-bottom:2px solid #e2e8f0; margin-bottom:22px; overflow-x:auto; }
.dash-tab{ padding:10px 4px; margin-right:20px; font-size:13.5px; font-weight:600; color:var(--dash-muted); text-decoration:none; border-bottom:2.5px solid transparent; white-space:nowrap; background:none; border-top:none; border-left:none; border-right:none; cursor:pointer; }
.dash-tab.active{ color:var(--dash-text); border-bottom-color: var(--dash-border); }

/* ── Toggle switch ── */
.switch{ position:relative; display:inline-block; width:40px; height:22px; flex-shrink:0; }
.switch input{ opacity:0; width:0; height:0; }
.switch-track{ position:absolute; inset:0; background:#cbd5e1; border-radius:99px; cursor:pointer; transition:.15s; }
.switch-track::before{ content:''; position:absolute; width:16px; height:16px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.15s; }
.switch input:checked + .switch-track{ background: var(--dash-border); }
.switch input:checked + .switch-track::before{ transform: translateX(18px); }

/* ── Progress bar (quota usage) ── */
.usage-bar{ height:9px; border-radius:99px; background:#e2e8f0; overflow:hidden; }
.usage-bar-fill{ height:100%; background: var(--dash-border); border-radius:99px; }

/* ── Copy field (API key) ── */
.key-row{ display:flex; align-items:center; gap:8px; font-family:var(--mono,monospace); font-size:13px; }
.key-actions{ display:flex; gap:6px; }
.key-icon-btn{ width:30px;height:30px; display:grid; place-items:center; border:1.5px solid #e2e8f0; border-radius:7px; background:#fff; color:#64748b; cursor:pointer; }
.key-icon-btn:hover{ background:var(--dash-bg); color:var(--dash-text); }

/* ── Mini sparkline chart ── */
.chart-wrap{ position:relative; height:220px; }
.chart-wrap svg{ width:100%; height:100%; overflow:visible; }

/* ============================================================
   Auth pages (login / register / verify email)
   ============================================================ */
.auth-body{ min-height:100vh; }
.auth-shell{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:40px 16px; }
.auth-wrap{ width:100%; max-width:440px; }
.auth-topbar{ display:flex; align-items:center; justify-content:space-between; margin-bottom:26px; }
.auth-logo{ display:inline-flex; background:var(--dash-border); color:#fff; font-weight:800; font-size:13px; letter-spacing:.03em; padding:8px 14px; border-radius:8px; text-decoration:none; }

.auth-illustration{ display:flex; justify-content:center; margin-bottom:6px; }
.auth-illustration-box{ width:110px; height:80px; background:var(--dash-border); border:3px solid var(--dash-border); border-radius:12px; display:flex; align-items:center; justify-content:center; box-shadow:6px 6px 0 #d0d3d8; position:relative; }
.auth-illustration-box span{ color:#fff; font-family:var(--mono,monospace); font-weight:700; font-size:15px; }
.auth-illustration-box::after{ content:''; position:absolute; bottom:-14px; left:50%; transform:translateX(-50%); width:60%; height:14px; background:#e5e7eb; border:2px solid var(--dash-border); border-radius:0 0 8px 8px; }

.auth-heading{ font-size:26px; font-weight:800; text-align:center; margin:14px 0 6px; }
.auth-subheading{ text-align:center; color:var(--dash-muted); font-size:14px; margin-bottom:26px; }

.auth-card{ background:#fff; border:2.5px solid var(--dash-border); border-radius:16px; box-shadow: var(--dash-shadow); padding:26px; }
.auth-divider{ display:flex; align-items:center; gap:12px; color:#94a3b8; font-size:12px; margin:18px 0; }
.auth-divider::before, .auth-divider::after{ content:''; flex:1; height:1px; background:#e2e8f0; }
.auth-btn-oauth{ display:flex; align-items:center; justify-content:center; gap:10px; width:100%; padding:11px; border:2px solid #e2e8f0; border-radius:9px; background:#fff; font-weight:600; font-size:13.5px; cursor:pointer; text-decoration:none; color:var(--dash-text); }
.auth-btn-oauth:hover{ background:var(--dash-bg); }
.auth-footer-note{ text-align:center; font-size:13px; color:var(--dash-muted); margin-top:20px; }
.auth-bottom-links{ text-align:center; font-size:12px; color:#94a3b8; margin-top:26px; }
.auth-bottom-links a{ color:#94a3b8; }

.auth-error{ background:var(--dash-red-bg); border:1.5px solid #fecaca; color:var(--dash-red); font-size:13px; padding:10px 12px; border-radius:9px; margin-bottom:16px; display:none; }
.auth-error.show{ display:block; }

.pw-strength{ display:flex; gap:4px; margin-top:8px; }
.pw-strength-seg{ height:4px; flex:1; border-radius:99px; background:#e2e8f0; }
.pw-strength-label{ font-size:11.5px; color:var(--dash-muted); margin-top:4px; }

/* ── Shared modal dialog (replaces native alert/confirm) ── */
.fz-modal .modal-dialog{ max-width:420px; }
.fz-modal-content{ border:2.5px solid var(--dash-border); border-radius:16px; box-shadow: var(--dash-shadow); padding:6px; position:relative; }
.fz-modal-close{ position:absolute; top:12px; right:12px; width:28px; height:28px; border:none; background:transparent; color:#94a3b8; font-size:14px; cursor:pointer; z-index:2; }
.fz-modal-close:hover{ color:var(--dash-text); }
.fz-modal-body{ text-align:center; padding:30px 26px 10px; }
.fz-modal-icon{ width:52px; height:52px; margin:0 auto 14px; border-radius:50%; display:grid; place-items:center; font-size:22px; }
.fz-modal-icon.variant-info{ background:#eff6ff; color:#2563eb; }
.fz-modal-icon.variant-success{ background:var(--dash-green-bg); color:var(--dash-green); }
.fz-modal-icon.variant-danger{ background:var(--dash-red-bg); color:var(--dash-red); }
.fz-modal-icon.variant-warning{ background:var(--dash-yellow-bg); color:var(--dash-yellow); }
.fz-modal-title{ font-size:18px; font-weight:800; margin-bottom:8px; }
.fz-modal-message{ font-size:13.5px; color:var(--dash-muted); line-height:1.6; text-align:left; }
.fz-modal-message p{ text-align:center; }
.fz-modal-footer{ border-top:none; padding:16px 26px 24px; display:flex; gap:10px; justify-content:center; }
.fz-modal-footer .dash-btn{ flex:1; }
@media(max-width:420px){
  .fz-modal .modal-dialog{ margin:12px; }
  .fz-modal-body{ padding:26px 18px 8px; }
  .fz-modal-footer{ padding:14px 18px 20px; }
}

/* OTP boxes */
.otp-row{ display:flex; gap:8px; justify-content:center; margin:22px 0 10px; }
.otp-box{ width:46px; height:54px; text-align:center; font-size:22px; font-weight:700; border:2px solid #e2e8f0; border-radius:10px; flex-shrink:1; min-width:0; }
.otp-box:focus{ outline:none; border-color: var(--dash-border); box-shadow:0 0 0 3px rgba(10,10,15,.08); }

.verify-email-chip{ display:inline-block; background:var(--dash-bg); border:1.5px solid #e2e8f0; border-radius:8px; padding:6px 12px; font-size:13px; font-weight:600; margin:4px 0 18px; word-break:break-all; max-width:100%; }

@media(max-width:400px){
  .otp-row{ gap:5px; }
  .otp-box{ width:38px; height:48px; font-size:19px; border-radius:8px; }
  .auth-card{ padding:20px 16px; }
  .auth-illustration-box{ width:88px; height:64px; }
  .auth-heading{ font-size:22px; }
}

@media(max-width:576px){
  .auth-shell{ padding:24px 12px; }
  .auth-card{ padding:22px 18px; border-radius:14px; }
  .auth-heading{ font-size:23px; }
  .auth-subheading{ font-size:13.5px; padding:0 4px; }
}
