/* ====================================================================
   style.css — HMG CBT Pro Unified Design System & Layout
   ==================================================================== */
:root {
  --bg: #09090b;
  --surface: #18181b;
  --surface-2: #27272a;
  --surface-hover: #323238;
  --border: #27272a;
  --border-light: #3f3f46;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --primary: #10b981;
  --primary-dim: rgba(16, 185, 129, 0.12);
  --primary-hover: #059669;
  --accent: #8b5cf6;
  --accent-dim: rgba(139, 92, 246, 0.12);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.12);
  --info: #3b82f6;
  --info-dim: rgba(59, 130, 246, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 12px 36px rgba(0,0,0,0.35);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-hover: #e2e8f0;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --shadow: 0 10px 30px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ── Typography ── */
h1, h2, h3, h4, h5 { font-weight: 800; line-height: 1.25; color: var(--text); }
h1 { font-size: clamp(22px, 3.5vw, 32px); margin-bottom: 8px; }
h2 { font-size: clamp(18px, 2.5vw, 24px); margin-bottom: 12px; }
h3 { font-size: 18px; margin-bottom: 8px; }
p { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout & Containers ── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 900;
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
}
.brand-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s;
}
.nav-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-btn.active {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: rgba(16, 185, 129, 0.3);
}

.main-wrap {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
  flex: 1;
}

/* ── Cards & Surfaces ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ── Grid Systems ── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.flex-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { background: var(--primary-hover); opacity: 0.95; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-light); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning-dim); color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.btn-info { background: var(--info-dim); color: var(--info); border-color: rgba(59, 130, 246, 0.3); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }

/* ── Forms & Inputs ── */
label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ── Badges & Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-primary { background: var(--primary-dim); color: var(--primary); border: 1px solid rgba(16,185,129,0.3); }
.badge-accent { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(139,92,246,0.3); }
.badge-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.badge-warning { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-info { background: var(--info-dim); color: var(--info); border: 1px solid rgba(59,130,246,0.3); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; width: 100%; margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th { background: var(--surface-2); padding: 12px 14px; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Stat Boxes ── */
.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.stat-val { font-size: 28px; font-weight: 900; color: var(--primary); line-height: 1.1; margin-bottom: 4px; }
.stat-lbl { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Toasts ── */
#cbt-toast {
  position: fixed;
  bottom: -100px;
  right: 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99999;
  max-width: 360px;
}
#cbt-toast.show { bottom: 24px; }

/* ── Footer ── */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
}

@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .nav-links { overflow-x: auto; padding-bottom: 4px; flex-wrap: nowrap; }
  .main-wrap { padding: 16px 12px 36px; }
  .card { padding: 16px; }
}
