/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117; --sidebar: #0a0d14; --bg-card: #161b27; --bg-hover: #1e2535;
  --border: #1e2535; --border2: #2a3448;
  --accent: #6366f1; --accent2: #8b5cf6;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --green: #10b981; --red: #ef4444; --yellow: #f59e0b;
  --text: #e2e8f0; --text2: #64748b; --text3: #3d4f6b;
  --sidebar-w: 240px; --topbar-h: 56px;
  --radius: 10px; --font: 'Inter', system-ui, sans-serif;
}
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100; overflow-y: auto;
}
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo a { font-size: 1.1rem; font-weight: 800; letter-spacing: -.5px; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sidebar-logo small { display: block; font-size: .7rem; color: var(--text3); -webkit-text-fill-color: var(--text3); margin-top: 2px; }
.sidebar-section { padding: 16px 12px 8px; }
.sidebar-label { font-size: .68rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; padding: 0 8px; margin-bottom: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: var(--text2);
  font-size: .875rem; font-weight: 500; transition: all .15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(99,102,241,.12); color: var(--accent); }
.nav-item .icon { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding: 16px 12px; border-top: 1px solid var(--border); }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-name { font-size: .825rem; font-weight: 600; }
.user-role { font-size: .72rem; color: var(--text2); }

/* ===== LAYOUT ===== */
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: rgba(15,17,23,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  padding: 0 28px; gap: 16px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 700; flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; width: 220px;
}
.topbar-search input { background: none; border: none; color: var(--text); font-size: .85rem; outline: none; width: 100%; }
.topbar-search input::placeholder { color: var(--text3); }
.page-content { padding: 28px 32px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.3px; }
.page-header p { color: var(--text2); font-size: .875rem; margin-top: 4px; }

/* ===== METRIC CARDS ===== */
.metrics-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 28px; }
.metric-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.metric-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.metric-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.metric-icon.purple { background: rgba(99,102,241,.15); }
.metric-icon.green { background: rgba(16,185,129,.15); }
.metric-icon.yellow { background: rgba(245,158,11,.15); }
.metric-icon.blue { background: rgba(6,182,212,.15); }
.metric-change { font-size: .72rem; font-weight: 600; color: var(--green); }
.metric-value { font-size: 1.8rem; font-weight: 900; letter-spacing: -.5px; line-height: 1; }
.metric-label { font-size: .78rem; color: var(--text2); margin-top: 4px; }

/* ===== CARDS ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.content-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; transition: border-color .2s; }
.content-card:hover { border-color: var(--border2); }
.card-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 3px 9px; border-radius: 5px; display: inline-block; margin-bottom: 10px; background: rgba(99,102,241,.12); color: #a5b4fc; }
.card-stock { font-size: .72rem; font-weight: 700; color: var(--green); }
.card-price { font-size: 1.3rem; font-weight: 900; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ===== TABLE ===== */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.table-card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.table-card-header h3 { font-size: .95rem; font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; padding: 10px 16px; color: var(--text2); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); background: rgba(0,0,0,.15); }
td { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
.td-main { color: var(--text); font-weight: 600; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 8px; font-size: .85rem; font-weight: 600; cursor: pointer; border: none; transition: all .15s; text-decoration: none !important; font-family: var(--font); }
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-ghost { background: var(--bg-hover); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 5px; font-size: .72rem; font-weight: 700; }
.badge-green { background: rgba(16,185,129,.12); color: var(--green); }
.badge-purple { background: rgba(99,102,241,.12); color: #a5b4fc; }
.badge-yellow { background: rgba(245,158,11,.12); color: var(--yellow); }
.badge-gray { background: rgba(100,116,139,.1); color: var(--text2); }
.badge-red { background: rgba(239,68,68,.12); color: var(--red); }

/* ===== CODE ===== */
pre, code { font-family: 'JetBrains Mono','Fira Code',monospace; font-size: .82rem; }
pre { background: var(--sidebar); border: 1px solid var(--border); border-radius: 8px; padding: 16px; overflow-x: auto; position: relative; line-height: 1.6; }
code { background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; color: #a5b4fc; }
pre code { background: none; padding: 0; color: var(--text); }

/* ===== MISC ===== */
.loading { display: flex; gap: 5px; justify-content: center; padding: 40px; }
.loading span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; opacity: .6; }
.loading span:nth-child(2) { animation-delay: .2s; }
.loading span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.6}30%{transform:translateY(-8px);opacity:1} }
input, textarea, select { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: .875rem; outline: none; font-family: var(--font); transition: border-color .2s; }
input:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: var(--text3); }

/* ===== DOCS ===== */
.docs-wrap { display: grid; grid-template-columns: 200px 1fr; }
.docs-nav { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 20px 12px; border-right: 1px solid var(--border); background: var(--bg-card); }
.docs-nav h4 { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); padding: 0 8px; margin: 14px 0 6px; }
.docs-nav a { display: block; padding: 6px 10px; border-radius: 7px; font-size: .83rem; color: var(--text2); transition: all .15s; }
.docs-nav a:hover { color: var(--text); background: var(--bg-hover); }
.docs-body { padding: 32px; max-width: 740px; }
.endpoint { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin: 20px 0; overflow: hidden; }
.ep-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.method { font-family: monospace; font-weight: 800; font-size: .78rem; padding: 3px 9px; border-radius: 5px; }
.method-get { background: rgba(16,185,129,.12); color: var(--green); }
.method-post { background: rgba(99,102,241,.12); color: #a5b4fc; }
.ep-path { font-family: monospace; font-size: .88rem; }
.ep-body { padding: 16px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) { .metrics-row { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); transition: transform .2s; }
  .main-wrap { margin-left: 0; }
  .topbar-search { display: none; }
  .page-content { padding: 16px; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .docs-wrap { grid-template-columns: 1fr; }
  .docs-nav { display: none; }
}
