/* ══════════════════════════════════════════════════════════════
   V30 DESIGN SYSTEM — Global Override
   Applied to sales1.platox.net only
   ══════════════════════════════════════════════════════════════ */

:root,
[data-theme="dark"] {
  --bg: #0f1419;
  --bg-card: #1a1f2e;
  --bg-elevated: #232838;
  --border: #2d3548;
  --text: #e8ecf1;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #ff7a59;
  --accent-hover: #e8603f;
  --success: #00bda5;
  --warning: #f5c26b;
  --danger: #f2545b;
  --shadow: 0 1px 2px rgba(0,0,0,0.3);
  --input-bg: #1a1f2e;
  --tooltip-bg: #1a1f2e;
  --tooltip-border: #2d3548;
  --chart-grid: rgba(255,255,255,0.04);
  --scrollbar-thumb: #2d3548;
  --badge-gray-bg: rgba(255,255,255,0.06);
  --badge-gray-text: #94a3b8;
  --v30-coral: #ff7a59;
  --v30-teal: #00a4bd;
  --v30-link: #22d3ee;
}

[data-theme="light"] {
  --bg: #f5f8fa;
  --bg-card: #ffffff;
  --bg-elevated: #f0f3f5;
  --border: #cbd6e2;
  --text: #33475b;
  --text-secondary: #516f90;
  --text-muted: #7c98b6;
  --accent: #ff7a59;
  --accent-hover: #e8603f;
  --success: #00bda5;
  --warning: #f5c26b;
  --danger: #f2545b;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
  --input-bg: #ffffff;
  --tooltip-bg: #ffffff;
  --tooltip-border: #cbd6e2;
  --chart-grid: rgba(0,0,0,0.04);
  --scrollbar-thumb: #cbd6e2;
  --badge-gray-bg: rgba(51,71,91,0.06);
  --badge-gray-text: #516f90;
  --v30-coral: #ff7a59;
  --v30-teal: #0091ae;
  --v30-link: #0091ae;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar-brand { padding: 14px 18px 8px; }
.app-name { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }
.ss-trigger { border-radius: 6px; padding: 8px 10px; }
.ss-trigger:hover { border-color: var(--accent); background: rgba(255,122,89,0.04); }
.ss-store-icon { border-radius: 6px; background: rgba(255,122,89,0.08); }
.nav-item a { border-radius: 6px; padding: 9px 12px; font-size: 13px; font-weight: 400; min-height: 40px; transition: all 0.2s ease; }
.nav-item a:hover { background: var(--bg-elevated); }
.nav-item a.active { background: rgba(255,122,89,0.08); border-left: 3px solid var(--accent); color: var(--accent); font-weight: 500; }
.nav-section-label { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--text-muted); }
.nav-sub-item a { font-size: 12px; }
.nav-sub-item a.active { color: var(--accent); }
.nav-sub-item a::before { background: var(--accent); }
.sidebar-user-avatar { border-radius: 6px; }
.ss-dropdown { border-radius: 8px; }
.ss-option:hover { background: var(--bg-elevated); }
.ss-option-active { background: rgba(255,122,89,0.06); }

/* ── Header ───────────────────────────────────────────────── */
#header { height: 56px; padding: 0 24px; }
#header-title { font-size: 15px; font-weight: 600; }
.live-badge { background: rgba(0,189,165,0.08); border-color: rgba(0,189,165,0.2); color: var(--success); font-size: 11px; }
.live-dot { background: var(--success); }
.header-date { font-size: 11px; }

/* ── Page Header ──────────────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.page-header p { font-size: 13px; color: var(--text-muted); }

/* ── Cards ─────────────────────────────────────────────────── */
.card { border-radius: 6px; padding: 20px; box-shadow: var(--shadow); transition: border-color 0.2s ease; }
.card:hover { border-color: rgba(255,122,89,0.2); }
.card-title { font-size: 14px; font-weight: 600; }

/* ── KPI Cards ─────────────────────────────────────────────── */
.kpi-card { border-radius: 6px; padding: 18px 20px; box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); }
.kpi-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── Tables ────────────────────────────────────────────────── */
.data-table { font-size: 13px; }
.data-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); padding: 10px 16px; background: var(--bg-elevated); }
.data-table td { padding: 12px 16px; font-variant-numeric: tabular-nums; }
.data-table .num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.data-table tr:hover td { background: rgba(0,164,189,0.04); }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { border-bottom: none; gap: 3px; padding: 3px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 20px; display: inline-flex; }
.tab-btn { padding: 10px 16px; font-size: 13px; font-weight: 400; color: var(--text-secondary); border: none; border-radius: 6px; border-bottom: none; cursor: pointer; transition: all 0.2s ease; min-height: 40px; }
.tab-btn:hover { color: var(--text); background: var(--bg-card); }
.tab-btn.active { background: var(--accent); color: #fff; font-weight: 500; border-bottom: none; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn { border-radius: 6px; font-weight: 500; font-size: 13px; padding: 8px 16px; transition: all 0.2s ease; }
.btn-primary { background: var(--accent); color: #fff; border: none; }
.btn-primary:hover { background: var(--accent-hover); opacity: 1; }
.btn-secondary { border: 1px solid var(--border); color: var(--text-secondary); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: rgba(255,122,89,0.04); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Badges ────────────────────────────────────────────────── */
.badge { border-radius: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px; }
.badge-green { background: rgba(0,189,165,0.1); color: var(--success); }
.badge-red { background: rgba(242,84,91,0.1); color: var(--danger); }
.badge-yellow { background: rgba(245,194,107,0.1); color: #d4920a; }
.badge-blue { background: rgba(0,164,189,0.1); color: #00a4bd; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-input, .form-select, .form-textarea { border-radius: 6px; font-size: 13px; padding: 9px 12px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,122,89,0.1); }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }

/* ── Filter Bar ────────────────────────────────────────────── */
.filter-bar { gap: 10px; margin-bottom: 16px; }
.filter-bar .form-select { font-size: 12px; padding: 7px 10px; border-radius: 6px; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state { padding: 48px 20px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-title { font-size: 15px; font-weight: 600; }
.empty-sub { font-size: 13px; color: var(--text-muted); }

/* ── Skeleton ──────────────────────────────────────────────── */
.skeleton { border-radius: 6px; }

/* ── Toast, Modal, Integration ─────────────────────────────── */
.toast { border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.modal { border-radius: 8px; }
.integration-card { border-radius: 6px; }
.integration-card:hover { border-color: var(--accent); }
.trp-trigger { border-radius: 6px; }
.trp-dropdown { border-radius: 8px; }
.trp-option-active { color: var(--accent); }

/* ── Reduced Motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .skeleton, .kpi-card, .card, .btn, .tab-btn, .nav-item a,
  .data-table tr, .form-input, .form-select { transition: none !important; }
  .kpi-card:hover { transform: none !important; }
  .skeleton { animation: none !important; }
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
}

/* ── Additional V30 Overrides ──────────────────────────────── */

/* AI nav item — coral gradient instead of blue */
.nav-item a[href="#/ai"] { background: linear-gradient(135deg, rgba(255,122,89,0.08), rgba(0,164,189,0.08)) !important; }
.nav-item a[href="#/ai"]:hover { background: linear-gradient(135deg, rgba(255,122,89,0.15), rgba(0,164,189,0.12)) !important; }

/* Chart default colors override */
.chart-wrap canvas { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Settings page cards */
.sc-pill.active, .sc-pill:hover { background: var(--accent) !important; color: #fff !important; }

/* Inventory tabs */
.inv-tab.active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* Store Intelligence tabs */
.si-tab.active { background: var(--accent) !important; color: #fff !important; }

/* Google Ads tabs */
.gads-tab.active { background: var(--accent) !important; color: #fff !important; }

/* User menu dropdown */
.um-dropdown { border-radius: 8px; }
.um-item:hover { background: var(--bg-elevated); }

/* All accent-colored borders to coral */
[style*="border-top:3px solid var(--accent)"],
[style*="border-left:3px solid var(--accent)"] { border-color: var(--accent) !important; }

/* Focus visible global */
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Monospace Numbers (Global) ────────────────────────────── */
.kpi-value, .kpi-sm .kpi-value,
.data-table .num,
.data-table td:nth-child(n+2) {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* ── Chart Colors Override (Chart.js datasets) ─────────────── */
/* These are handled via JS, but tooltip and axis styling: */
.chart-wrap {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Login Page — V30 Branding ─────────────────────────────── */
.login-container {
  border-radius: 6px;
}

/* ── All page tabs — pill style override ───────────────────── */
.tabs, .gads-tab, .inv-tab, .si-tab {
  border-bottom: none !important;
}

/* ── Grid responsiveness improvements ──────────────────────── */
@media (max-width: 600px) {
  .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 18px; }
}

/* ── Accessibility — Skip Link ─────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0 0 6px 0;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ── Smooth Page Transitions ───────────────────────────────── */
#outlet {
  animation: v30-fadeIn 0.2s ease;
}
@keyframes v30-fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  #outlet { animation: none !important; }
}
