/* =========================================================
   SHIFT AUTO SUPPLY — Design System
   Premium Automotive Ecommerce
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ─── Color Tokens ──────────────────────────────────────── */
:root {
  /* Brand */
  --blue:        #0066CC;
  --blue-dark:   #004FA3;
  --blue-light:  #3385D6;
  --blue-50:     #E6F0FA;
  --blue-100:    #CCE0F5;
  --crimson:     #E02424;
  --crimson-dark:#BC1C1C;
  --crimson-50:  #FEE8E8;

  /* Neutral scale */
  --neutral-0:   #FFFFFF;
  --neutral-50:  #FAFAFA;
  --neutral-100: #F3F4F6;
  --neutral-200: #E5E7EB;
  --neutral-300: #D1D5DB;
  --neutral-400: #9CA3AF;
  --neutral-500: #6B7280;
  --neutral-600: #4B5563;
  --neutral-700: #374151;
  --neutral-800: #1F2937;
  --neutral-900: #111827;

  /* Semantic tokens - Light mode */
  --bg-base:         var(--neutral-50);
  --bg-card:         var(--neutral-0);
  --bg-elevated:     var(--neutral-100);
  --bg-overlay:      rgba(17, 24, 39, 0.6);

  --text-primary:    var(--neutral-800);
  --text-secondary:  var(--neutral-500);
  --text-muted:      var(--neutral-400);
  --text-inverse:    var(--neutral-0);

  --border:          var(--neutral-200);
  --border-strong:   var(--neutral-300);
  --divider:         var(--neutral-200);

  --shadow-xs:  0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.1),  0 8px 10px rgba(0,0,0,.04);
  --shadow-blue: 0 0 0 3px rgba(0, 102, 204, 0.2);

  /* Typography */
  --font-head: 'Sora', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Border radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --container-max: 1440px;
  --container-lg:  1280px;
  --container-md:  960px;
  --header-height: 64px;
  --header-height-scroll: 56px;
}

/* Dark mode */
[data-theme="dark"] {
  --bg-base:         #0F1117;
  --bg-card:         #1A1F2E;
  --bg-elevated:     #212736;
  --bg-overlay:      rgba(0, 0, 0, 0.75);

  --text-primary:    #F1F5F9;
  --text-secondary:  #94A3B8;
  --text-muted:      #64748B;
  --text-inverse:    #0F1117;

  --border:          #2A3045;
  --border-strong:   #374151;
  --divider:         #1E2533;

  --shadow-xs:  0 1px 2px rgba(0,0,0,.3);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:  0 4px 6px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.2);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.5), 0 4px 6px rgba(0,0,0,.3);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.5), 0 8px 10px rgba(0,0,0,.3);

  --blue-50:     rgba(0, 102, 204, 0.12);
  --blue-100:    rgba(0, 102, 204, 0.2);
  --crimson-50:  rgba(224, 36, 36, 0.12);
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-base), color var(--transition-base);
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); line-height: 1.2; font-weight: 700; }

/* ─── Typography Scale ──────────────────────────────────── */
.text-xs   { font-size: 11px; }
.text-sm   { font-size: 13px; }
.text-base { font-size: 15px; }
.text-md   { font-size: 17px; }
.text-lg   { font-size: 19px; }
.text-xl   { font-size: 22px; }
.text-2xl  { font-size: 26px; }
.text-3xl  { font-size: 32px; }
.text-4xl  { font-size: 40px; }
.text-5xl  { font-size: 52px; }

.font-light   { font-weight: 300; }
.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semi    { font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-extra   { font-weight: 800; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-blue      { color: var(--blue); }
.text-crimson   { color: var(--crimson); }
.text-white     { color: #fff; }

/* ─── Layout Utilities ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.container-sm  { max-width: var(--container-md); }
.container-full { max-width: var(--container-max); }

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

/* ─── Section Spacing ───────────────────────────────────── */
.section { padding: var(--space-20) 0; }
.section-sm { padding: var(--space-12) 0; }
.section-lg { padding: var(--space-24) 0; }

.section-header {
  margin-bottom: var(--space-10);
}
.section-header h2 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.section-header p {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: 16px;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: var(--space-3);
}
.section-label::before {
  content: '';
  display: block;
  width: 20px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 11px var(--space-6);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 102, 204, 0.3);
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 4px 12px rgba(0,102,204,0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card); border-color: var(--border-strong); }

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-outline:hover { background: var(--blue-50); }

.btn-danger {
  background: var(--crimson);
  color: #fff;
}
.btn-danger:hover { background: var(--crimson-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }

.btn-sm { padding: 7px var(--space-4); font-size: 13px; }
.btn-lg { padding: 14px var(--space-8); font-size: 16px; border-radius: var(--radius-lg); }
.btn-xl { padding: 18px var(--space-10); font-size: 17px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-round { border-radius: var(--radius-full); }

.btn-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: var(--space-2);
}

/* ─── Form Elements ─────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: var(--shadow-blue);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.error { border-color: var(--crimson); }
.form-error { font-size: 12px; color: var(--crimson); margin-top: 2px; }
.form-hint  { font-size: 12px; color: var(--text-muted); }

/* ─── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-blue    { background: var(--blue-50);    color: var(--blue); }
.badge-crimson { background: var(--crimson-50); color: var(--crimson); }
.badge-green   { background: #E8F5E9;           color: #2E7D32; }
.badge-yellow  { background: #FFF8E1;           color: #F57F17; }
.badge-gray    { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-dark    { background: var(--text-primary); color: var(--text-inverse); }

[data-theme="dark"] .badge-green  { background: rgba(46,125,50,.2);   color: #81C784; }
[data-theme="dark"] .badge-yellow { background: rgba(245,127,23,.15); color: #FFD54F; }

/* ─── Status Badges ─────────────────────────────────────── */
.status-pending         { @extend .badge-yellow; }
.status-under_review    { @extend .badge-yellow; }
.status-confirmed       { @extend .badge-green; }
.status-processing      { @extend .badge-blue; }
.status-shipped         { @extend .badge-blue; }
.status-delivered       { @extend .badge-green; }
.status-cancelled       { @extend .badge-crimson; }
.status-failed          { @extend .badge-crimson; }

/* ─── Dividers ──────────────────────────────────────────── */
.divider { height: 1px; background: var(--divider); border: none; margin: var(--space-6) 0; }
.divider-v { width: 1px; height: 100%; background: var(--divider); }

/* ─── Skeletons ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--divider) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Animations ────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse   { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.animate-fadeIn  { animation: fadeIn  var(--transition-base) ease both; }
.animate-slideUp { animation: slideUp var(--transition-base) ease both; }
.animate-scaleIn { animation: scaleIn var(--transition-base) ease both; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--neutral-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neutral-400); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--neutral-700); }

/* ─── Focus styles ──────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ─── Selection ─────────────────────────────────────────── */
::selection { background: var(--blue-100); color: var(--blue-dark); }

/* ─── Utility ───────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.hidden  { display: none !important; }
.invisible { visibility: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pointer { cursor: pointer; }
.select-none { user-select: none; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.sticky-top { position: sticky; top: 0; z-index: 100; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hide-md { display: none !important; }
}
@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
  .section { padding: var(--space-12) 0; }
  .hide-sm { display: none !important; }
  .show-sm { display: flex !important; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
}

/* =========================================================
   GLOBAL RESPONSIVE FIXES
   ========================================================= */

/* Prevent horizontal overflow site-wide */
html, body { overflow-x: hidden; max-width: 100vw; }
* { box-sizing: border-box; }
img { max-width: 100%; height: auto; }

/* Grid helpers responsive */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Container padding on small screens */
@media (max-width: 480px) {
  .container { padding: 0 var(--space-4); }
  .section { padding: var(--space-10) 0; }
  .section-sm { padding: var(--space-6) 0; }
}

/* Section headings responsive */
@media (max-width: 480px) {
  h2 { font-size: clamp(20px, 5vw, 28px); }
  .section-header p { font-size: 14px; }
}

/* Buttons — no overflow */
.btn {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-full { width: 100%; justify-content: center; }

/* Form inputs — full width on mobile */
@media (max-width: 480px) {
  .form-input, select.form-input { height: 44px; font-size: 16px; } /* 16px prevents iOS zoom */
}

/* Drawer responsive */
@media (max-width: 480px) {
  .drawer { width: min(360px, 94vw) !important; }
}

/* Hide / show utilities */
@media (max-width: 768px) { .hide-sm { display: none !important; } }
@media (min-width: 769px) { .show-sm { display: none !important; } }
