/* dashboard.css — shared styles for all dashboard pages
   Requires auth.css for design tokens */

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--auth-bg);
  color: var(--auth-text);
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */

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

.topbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--auth-accent);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wallet-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--auth-accent-bg);
  border: 1px solid var(--auth-accent);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--auth-accent);
  text-decoration: none;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--auth-accent-bg);
  border: 1px solid var(--auth-accent);
  color: var(--auth-accent);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--auth-dim);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
}

.icon-btn:hover { color: var(--auth-text); }

/* ── Page layout ─────────────────────────────────────────────────────────── */

.dash-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */

.dash-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--auth-surface);
  border-right: 1px solid var(--auth-border);
  padding: 1rem 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--auth-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 1rem 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  color: var(--auth-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s;
}

.nav-link i { font-size: 17px; flex-shrink: 0; }
.nav-link:hover { color: var(--auth-text); background: var(--auth-accent-bg); }

.nav-link.active {
  color: var(--auth-accent);
  background: var(--auth-accent-bg);
  border-left-color: var(--auth-accent);
}

.nav-divider {
  height: 1px;
  background: var(--auth-border);
  margin: 0.5rem 0;
}

/* ── Main content ────────────────────────────────────────────────────────── */

.dash-main {
  flex: 1;
  padding: 2rem 2rem 4rem;
  min-width: 0;
  max-width: 860px;
}

/* ── Page header ─────────────────────────────────────────────────────────── */

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--auth-text);
}

.page-sub {
  font-size: 0.85rem;
  color: var(--auth-dim);
  margin-top: 0.25rem;
}

/* ── Section ─────────────────────────────────────────────────────────────── */

.dash-section {
  margin-bottom: 2rem;
}

.dash-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--auth-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.875rem;
}

/* ── Card ────────────────────────────────────────────────────────────────── */

.dash-card {
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  overflow: hidden;
}

.dash-card-body { padding: 1.25rem; }

.dash-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--auth-border);
  gap: 1rem;
}

.dash-card-row:last-child { border-bottom: none; }

.dash-card-label {
  font-size: 0.82rem;
  color: var(--auth-dim);
  flex-shrink: 0;
  min-width: 140px;
}

.dash-card-value {
  font-size: 0.875rem;
  color: var(--auth-text);
  flex: 1;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */

.dash-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.dash-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--auth-dim);
}

.dash-input {
  background: var(--auth-input-bg);
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  color: var(--auth-text);
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.dash-input:focus { border-color: var(--auth-accent); }
.dash-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dash-select {
  background: var(--auth-input-bg);
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  color: var(--auth-text);
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
  font-family: inherit;
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.dash-btn {
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dash-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.dash-btn-primary {
  background: var(--auth-accent);
  color: #0a0c14;
}

.dash-btn-primary:hover:not(:disabled) { opacity: 0.88; }

.dash-btn-ghost {
  background: transparent;
  border: 1px solid var(--auth-border);
  color: var(--auth-text);
}

.dash-btn-ghost:hover:not(:disabled) {
  background: var(--auth-accent-bg);
  border-color: var(--auth-accent);
}

.dash-btn-danger {
  background: var(--auth-error-bg);
  border: 1px solid var(--auth-error);
  color: var(--auth-error);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.badge-active  { background: rgba(74,222,128,0.12);  color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
.badge-free    { background: var(--auth-accent-bg);  color: var(--auth-accent); border: 1px solid rgba(126,207,255,0.2); }
.badge-expired { background: var(--auth-error-bg);   color: var(--auth-error);  border: 1px solid rgba(248,113,113,0.2); }
.badge-pending { background: rgba(250,204,21,0.1);   color: #facc15; border: 1px solid rgba(250,204,21,0.2); }

/* ── Alert ───────────────────────────────────────────────────────────────── */

.dash-alert {
  border-radius: 8px;
  padding: 0.65rem 0.875rem;
  font-size: 0.82rem;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dash-alert.visible { display: flex; }
.dash-alert-success { background: var(--auth-success-bg); border: 1px solid var(--auth-success); color: var(--auth-success); }
.dash-alert-error   { background: var(--auth-error-bg);   border: 1px solid var(--auth-error);   color: var(--auth-error);   }
.dash-alert-info    { background: var(--auth-accent-bg);  border: 1px solid var(--auth-accent);  color: var(--auth-accent);  }

/* ── Table ───────────────────────────────────────────────────────────────── */

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dash-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--auth-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--auth-border);
}

.dash-table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--auth-border);
  color: var(--auth-text);
}

.dash-table tr:last-child td { border-bottom: none; }
.dash-table tbody tr:hover   { background: var(--auth-accent-bg); }

/* ── Toggle switch ───────────────────────────────────────────────────────── */

.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--auth-border);
}

.toggle-wrap:last-child { border-bottom: none; }

.toggle-info { flex: 1; }
.toggle-label { font-size: 0.875rem; color: var(--auth-text); font-weight: 500; }
.toggle-desc  { font-size: 0.78rem; color: var(--auth-dim); margin-top: 0.2rem; }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--auth-border-mid);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--auth-text);
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--auth-accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Avatar upload ───────────────────────────────────────────────────────── */

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--auth-accent-bg);
  border: 2px solid var(--auth-accent);
  color: var(--auth-accent);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-large img { width: 100%; height: 100%; object-fit: cover; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  padding: 1rem 1.125rem;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--auth-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--auth-text);
}

.stat-value.accent { color: var(--auth-accent); }
.stat-value.green  { color: #4ade80; }

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--auth-dim);
  font-size: 0.875rem;
}

.empty-state i { font-size: 32px; display: block; margin-bottom: 0.5rem; opacity: 0.6; }