﻿/* ── App Shell ────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  background: var(--color-surface);
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--color-navy);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-navy-mid);
}

.sidebar-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: -0.01em;
  display: block;
}

.sidebar-tagline {
  font-size: 11px;
  color: var(--color-text-mid);
  display: block;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-mid);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 8px 10px;
}

/* ── Nav Item ─────────────────────────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: #94A3B8;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-decoration: none;
}

.nav-item--active {
  background: rgba(37,99,235,0.2);
  color: var(--color-accent);
}

.nav-item--active:hover { background: rgba(37,99,235,0.25); color: var(--color-accent); }

.nav-item-icon { width: 16px; text-align: center; font-size: 14px; }

/* ── Sidebar User ─────────────────────────────────────────────────────────── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--color-navy-mid);
}

.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-name  { font-size: 13px; font-weight: 600; color: #fff; display: block; }
.sidebar-user-email { font-size: 11px; color: var(--color-text-mid); display: block; }
.sidebar-user-info  { flex: 1; overflow: hidden; }
.sidebar-user-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-signout {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-mid); font-size: 14px; padding: 4px;
  transition: color 0.15s;
}
.sidebar-signout:hover { color: var(--color-error); }

/* ── Not Found ────────────────────────────────────────────────────────────── */
.not-found {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 5rem; gap: 1rem; text-align: center; color: var(--color-text-mid);
}
.not-found h1 { font-family: var(--font-heading); font-size: 28px; color: var(--color-text); }

/* ── Responsive (App / Dashboard) ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid       { grid-template-columns: repeat(2, 1fr); }
  .features-grid    { grid-template-columns: repeat(2, 1fr); }
  .dashboard-charts { grid-template-columns: 1fr; }
  .db-mid-row       { grid-template-columns: 1fr; }
  .content-wrapper  { padding: 1.5rem; }
}

@media (max-width: 768px) {
  /* Sidebar — hidden off-screen on mobile */
  .sidebar      { transform: translateX(-100%); transition: transform 0.25s ease; }
  .main-content { margin-left: 0; }

  /* Content padding */
  .content-wrapper { padding: 1rem; }

  /* Grids */
  .playground-grid  { grid-template-columns: 1fr; }
  .support-grid     { grid-template-columns: 1fr; }
  .stats-grid       { grid-template-columns: 1fr 1fr; }
  .usage-stats-grid { grid-template-columns: 1fr 1fr; }
  .u-kpi-grid       { grid-template-columns: 1fr 1fr; }
  .u-ep-row         { grid-template-columns: 1fr 72px 72px; }
  .u-ep-bar-col     { display: none; }
  .features-grid    { grid-template-columns: 1fr; }
  .rate-limit-grid  { grid-template-columns: 1fr 1fr; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }

  /* Auth — hide decorative left panel */
  .auth-left { display: none; }
  .auth-right { padding: 1.25rem; }
  .auth-card  { padding: 1.75rem; }

  /* Section title */
  .section-title { font-size: 20px; }

  /* Stat card values */
  .stat-card-value { font-size: 22px; }

  /* Credits */
  .credits-remaining { font-size: 32px; }

  /* Playground */
  .pg-grid { grid-template-columns: 1fr; }

  /* OCR metrics — 2×2 on mobile */
  .ocr-metrics-strip { grid-template-columns: 1fr 1fr; }
  .ocr-metric-cell:nth-child(2) { border-right: none; }
  .ocr-metric-cell:nth-child(3) { border-top: 1px solid var(--color-border); }
  .ocr-metric-cell:nth-child(4) { border-top: 1px solid var(--color-border); border-right: none; }

  /* OCR field groups — single column */
  .ocr-fg-wrap { grid-template-columns: 1fr; }
  .ocr-fg:not(:first-child):nth-child(even) { border-left: none; border-top: 1px solid var(--color-border); }

  /* Data table — horizontal scroll */
  .table-card { overflow-x: auto; }
  .data-table { min-width: 520px; }

  /* Dashboard rows */
  .dashboard-key-row { grid-template-columns: 1fr; }
  .db-mid-row        { grid-template-columns: 1fr; }

  /* Rate limit grid */
  .rate-limit-grid { grid-template-columns: repeat(2, 1fr); }

  /* Pagination */
  .pagination { gap: 0.5rem; }
}

@media (max-width: 480px) {
  /* Stats full width */
  .stats-grid       { grid-template-columns: 1fr; }
  .usage-stats-grid { grid-template-columns: 1fr; }
  .u-kpi-grid       { grid-template-columns: 1fr; }
  .u-token-tiles    { grid-template-columns: 1fr 1fr; }
  .u-page-hdr       { flex-direction: column; gap: 0.5rem; }

  /* Rate limit single column */
  .rate-limit-grid { grid-template-columns: 1fr; }

  /* Auth */
  .auth-card { padding: 1.25rem; border-radius: var(--radius-lg); }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }

  /* Key display */
  .key-display-row { flex-wrap: wrap; }
  .key-value { font-size: 11px; }

  /* Credits display */
  .credits-remaining { font-size: 28px; }

  /* Table still scrollable */
  .data-table { min-width: 440px; }

  /* Content */
  .content-wrapper { padding: 0.75rem; }

  /* Stat card */
  .stat-card-value { font-size: 20px; }
}
