/* ============================================================
   SwornIn — App Shared Styles (auth, dashboard, inbox, etc.)
   ============================================================ */

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

:root {
  --bg:          #07090F;
  --bg-2:        #0C1120;
  --bg-3:        #111827;
  --surface:     rgba(255,255,255,0.04);
  --surface-h:   rgba(255,255,255,0.07);
  --border:      rgba(255,255,255,0.08);
  --border-h:    rgba(255,255,255,0.18);
  --text:        #EDF2FF;
  --text-2:      #8892A4;
  --text-3:      #505B6E;
  --accent:      #4F7EF7;
  --accent-2:    #7B5CF7;
  --gold:        #E8A020;
  --green:       #22C55E;
  --red:         #EF4444;
  --radius:      12px;
  --radius-sm:   7px;
  --transition:  0.25s cubic-bezier(0.4,0,0.2,1);
  --font:        'Inter', system-ui, sans-serif;
  --sidebar-w:   240px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 3px; }

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

/* ── TYPOGRAPHY ──────────────────────────────────────────── */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 17px; font-weight: 600; }
p  { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 18px;
}
.form-group label {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  letter-spacing: 0.01em;
}
.form-group label .required { color: var(--gold); margin-left: 2px; }

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=url],
select,
textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,126,247,0.12);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238892A4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.form-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Multi-select chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 100px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: all var(--transition);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.selected { border-color: var(--accent); background: rgba(79,126,247,0.12); color: var(--accent); }
.chip.gold.selected { border-color: var(--gold); background: rgba(232,160,32,0.1); color: var(--gold); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; outline: none;
  transition: all var(--transition); text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3a6ef0; box-shadow: 0 4px 20px rgba(79,126,247,0.3); text-decoration: none; }
.btn-gold { background: var(--gold); color: #1a0d00; }
.btn-gold:hover { background: #f0a820; box-shadow: 0 4px 20px rgba(232,160,32,0.3); text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.btn-outline:hover { border-color: var(--border-h); color: var(--text); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.btn-danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.2); text-decoration: none; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert {
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.5; margin-bottom: 16px;
}
.alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.25);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.25);  color: #86efac; }
.alert-info    { background: rgba(79,126,247,0.1); border: 1px solid rgba(79,126,247,0.25); color: #93c5fd; }
.alert-gold    { background: rgba(232,160,32,0.1); border: 1px solid rgba(232,160,32,0.25); color: #fcd34d; }

/* ── SPINNER ─────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card-sm { padding: 16px; }
.card:hover { border-color: var(--border-h); }

/* ── BADGE ───────────────────────────────────────────────── */
.badge-pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
}
.badge-green  { background: rgba(34,197,94,0.12);  color: var(--green);  border: 1px solid rgba(34,197,94,0.25); }
.badge-blue   { background: rgba(79,126,247,0.12); color: var(--accent); border: 1px solid rgba(79,126,247,0.25); }
.badge-gold   { background: rgba(232,160,32,0.12); color: var(--gold);   border: 1px solid rgba(232,160,32,0.25); }
.badge-grey   { background: var(--surface);        color: var(--text-2); border: 1px solid var(--border); }
.badge-red    { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.25); }

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.divider-text {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 12px; margin: 20px 0;
}
.divider-text::before, .divider-text::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

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

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 50;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.sidebar-logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2, #7B5CF7));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff; flex-shrink: 0;
}
.sidebar-logo-text { font-size: 16px; font-weight: 700; color: var(--text); }

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
  padding: 0 8px; margin-bottom: 6px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-2);
  text-decoration: none; transition: all var(--transition);
}
.sidebar-nav li a:hover { background: var(--surface); color: var(--text); }
.sidebar-nav li a.active { background: rgba(79,126,247,0.12); color: var(--accent); }
.sidebar-nav li a .nav-icon { font-size: 16px; flex-shrink: 0; }
.sidebar-nav li a .badge-count {
  margin-left: auto; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 100px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  margin-top: auto; padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition);
}
.sidebar-user:hover { background: var(--surface); }
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2, #7B5CF7));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.sidebar-user-role { font-size: 11px; color: var(--text-3); }

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}
.app-topbar {
  height: 56px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px;
  position: sticky; top: 0; z-index: 40;
  background: rgba(7,9,15,0.8); backdrop-filter: blur(16px);
}
.app-topbar h1 { font-size: 18px; }
.app-content { padding: 28px; flex: 1; }

/* ── TABLES ──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.data-table tr:hover td { background: var(--surface); }
.data-table tr:last-child td { border-bottom: none; }

/* ── STATS CARD ──────────────────────────────────────────── */
.stat-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.stat-card .stat-val { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.stat-card .stat-label { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-card .stat-delta { font-size: 12px; color: var(--green); margin-top: 4px; }

/* ── MESSAGE BUBBLE ──────────────────────────────────────── */
.msg-bubble {
  max-width: 70%; padding: 11px 15px;
  border-radius: 14px; font-size: 13px; line-height: 1.55;
  margin-bottom: 6px;
}
.msg-bubble.sent { background: var(--accent); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg-bubble.received { background: var(--bg-3); color: var(--text); border-bottom-left-radius: 4px; }
.msg-bubble.system { background: var(--surface); color: var(--text-3); margin: 0 auto; text-align: center; font-size: 11px; max-width: 90%; border-radius: var(--radius-sm); }
.msg-meta { font-size: 10px; color: var(--text-3); margin-top: 3px; }

/* ── CREDIT METER ────────────────────────────────────────── */
.credit-bar-wrap { background: var(--bg-3); border-radius: 100px; height: 6px; overflow: hidden; }
.credit-bar-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--accent), var(--accent-2, #7B5CF7)); transition: width 0.6s ease; }

/* ── PROGRESS STEPS ──────────────────────────────────────── */
.progress-steps { display: flex; align-items: center; gap: 0; margin-bottom: 40px; }
.progress-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-3);
}
.progress-step.active { color: var(--text); }
.progress-step.done   { color: var(--green); }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border); color: var(--text-3);
  flex-shrink: 0;
}
.progress-step.active .step-num { border-color: var(--accent); color: var(--accent); background: rgba(79,126,247,0.1); }
.progress-step.done   .step-num { border-color: var(--green);  color: var(--green);  background: rgba(34,197,94,0.1); }
.step-connector { flex: 1; height: 1px; background: var(--border); min-width: 24px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
}

/* ── AUTH PAGE SPECIFIC ──────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 24px;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(79,126,247,0.08), transparent);
}
.auth-card {
  width: 100%; max-width: 460px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px; text-decoration: none;
}
.auth-logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7B5CF7);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
}
.auth-logo-text { font-size: 20px; font-weight: 700; color: var(--text); }
