/* ============================================================
   SpectroNova™ Dealer Management System — Master Stylesheet
   ============================================================ */

:root {
  /* Brand Orange Palette */
  --or:       #E8671A;
  --or-dark:  #B84E10;
  --or-mid:   #F5A96A;
  --or-light: #FDF0E8;
  --or-pale:  #FEF7F2;

  /* Neutrals */
  --white:    #FFFFFF;
  --gray-1:   #F4F5F7;
  --gray-2:   #E8E8E8;
  --gray-3:   #D0D0D0;
  --gray-4:   #999999;
  --gray-5:   #666666;
  --gray-6:   #444444;
  --gray-7:   #222222;

  /* Sidebar */
  --dark:       #1A1B2E;
  --sidebar-bg: #1A1B2E;
  --sidebar-bg2:#14152A;

  /* Semantic */
  --green:  #1A7A2E;
  --blue:   #1A56A0;
  --red:    #C0392B;
  --amber:  #E8A817;

  /* Aliases */
  --success-green:  #1A7A2E;
  --warning-amber:  #E8A817;
  --error-red:      #C0392B;
  --info-blue:      #1A56A0;
  --accent-orange:  #E8671A;

  /* Layout */
  --sidebar-w: 230px;
  --header-h:  52px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  background: var(--gray-1);
  color: var(--gray-7);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--sidebar-bg2);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo-icon {
  width: 30px; height: 30px;
  background: var(--or);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
}
.sidebar-logo-text {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}
.sidebar-logo-text small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
}
.sidebar-section {
  padding: 16px 0 4px 18px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}
.sidebar-item.active {
  background: rgba(232,103,26,0.12);
  color: var(--or);
  border-left-color: var(--or);
  font-weight: 600;
}
.sidebar-item .si-icon {
  width: 18px; text-align: center; font-size: 14px;
}
.sidebar-item .si-num {
  width: 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
}
.sidebar-bottom {
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-bottom a {
  display: block;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  text-decoration: none;
  padding: 4px 0;
}
.sidebar-bottom a:hover { color: var(--or-mid); }

/* ---- Main ---- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-2);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.breadcrumb {
  font-size: 11px;
  color: var(--gray-5);
}
.breadcrumb span { color: var(--or-mid); font-weight: 600; }
.page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-7);
  margin-top: 1px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-6);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--or);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}

/* ---- Content ---- */
.content {
  padding: 20px 24px 32px;
  flex: 1;
  overflow-y: auto;
}

/* ---- Stat Cards ---- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  border-radius: 10px;
  padding: 18px 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.10);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.stat-card.c-dark     { background: #1F2937; }
.stat-card.c-dark::before     { background: linear-gradient(90deg, #F59E0B, #D97706); }
.stat-card.c-orange   { background: #FFF7ED; }
.stat-card.c-orange::before   { background: linear-gradient(90deg, #F59E0B, #D97706); }
.stat-card.c-green    { background: #ECFDF5; }
.stat-card.c-green::before    { background: linear-gradient(90deg, #10B981, #059669); }
.stat-card.c-blue     { background: #EFF6FF; }
.stat-card.c-blue::before     { background: linear-gradient(90deg, #3B82F6, #2563EB); }
.stat-card.c-purple   { background: #F5F3FF; }
.stat-card.c-purple::before   { background: linear-gradient(90deg, #8B5CF6, #7C3AED); }
.stat-card.c-red      { background: #FEF2F2; }
.stat-card.c-red::before      { background: linear-gradient(90deg, #EF4444, #DC2626); }
.stat-card.c-teal     { background: #F0FDFA; }
.stat-card.c-teal::before     { background: linear-gradient(90deg, #14B8A6, #0D9488); }
.stat-card.c-dark .stat-label     { color: rgba(255,255,255,0.7); }
.stat-card.c-orange .stat-label   { color: #92400E; }
.stat-card.c-green .stat-label    { color: #065F46; }
.stat-card.c-blue .stat-label     { color: #1E3A5F; }
.stat-card.c-purple .stat-label   { color: #5B21B6; }
.stat-card.c-red .stat-label      { color: #991B1B; }
.stat-card.c-teal .stat-label     { color: #134E4A; }
.stat-card.c-dark .stat-value     { color: #FCD34D; }
.stat-card.c-orange .stat-value   { color: #B45309; }
.stat-card.c-green .stat-value    { color: #047857; }
.stat-card.c-blue .stat-value     { color: #1D4ED8; }
.stat-card.c-purple .stat-value   { color: #6D28D9; }
.stat-card.c-red .stat-value      { color: #DC2626; }
.stat-card.c-teal .stat-value     { color: #0F766E; }
.stat-icon {
  font-size: 18px;
  margin-bottom: 6px;
  display: block;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}
.stat-sub {
  font-size: 11px;
  margin-top: 4px;
  font-weight: 600;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--gray-2);
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-2);
}
.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-7);
}
.card-body {
  padding: 18px;
}

/* ---- Data Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--gray-7);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-2);
  color: var(--gray-7);
}
.data-table tbody tr:hover {
  background: var(--or-pale);
}
.data-table tbody tr { cursor: pointer; }

/* ---- Tags ---- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tag-green  { background: #D1FAE5; color: #065F46; }
.tag-or     { background: #FDE8D0; color: #7C2D12; }
.tag-blue   { background: #DBEAFE; color: #1E3A5F; }
.tag-red    { background: #FEE2E2; color: #7F1D1D; }
.tag-gray   { background: #E5E7EB; color: #374151; }
.tag-amber  { background: #FEF3C7; color: #78350F; }
.tag-orange { background: #FED7AA; color: #7C2D12; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-md { padding: 8px 18px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-primary {
  background: var(--or);
  color: #fff;
}
.btn-primary:hover { background: var(--or-dark); }
.btn-secondary {
  background: var(--white);
  color: var(--gray-7);
  border: 1px solid var(--gray-2);
}
.btn-secondary:hover { border-color: var(--gray-4); }
.btn-ghost {
  background: transparent;
  color: var(--or);
}
.btn-ghost:hover { background: var(--or-light); }

/* ---- Info Bar ---- */
.info-bar {
  background: var(--or-light);
  border-left: 4px solid var(--or);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: var(--gray-7);
  margin-bottom: 16px;
}
.info-bar.info-blue {
  background: #E3EDF7;
  border-left-color: var(--blue);
}
.info-bar.info-green {
  background: #E6F4EA;
  border-left-color: var(--green);
}

/* ---- Hero Card (Index) ---- */
.hero-card {
  background: linear-gradient(135deg, #E8671A 0%, #F5A96A 100%);
  border-radius: 12px;
  padding: 32px 36px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-card h1 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}
.hero-card p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  max-width: 600px;
}

/* ---- Screen Grid (Index) ---- */
.screen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.screen-card {
  background: var(--white);
  border: 1px solid var(--gray-2);
  border-radius: 10px;
  padding: 20px;
  text-decoration: none;
  color: var(--gray-7);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.screen-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transform: translateY(-2px);
  border-color: var(--or-mid);
}
.screen-card .sc-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--or-light);
  color: var(--or);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.screen-card .sc-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--or);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.screen-card h3 {
  font-size: 15px;
  font-weight: 700;
}
.screen-card p {
  font-size: 12px;
  color: var(--gray-5);
  line-height: 1.5;
}
.screen-section-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-4);
  margin-top: 12px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-2);
}

/* ---- Placeholder Page ---- */
.placeholder-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--gray-4);
}
.placeholder-center .ph-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.placeholder-center h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-6);
  margin-bottom: 6px;
}
.placeholder-center p {
  font-size: 13px;
  max-width: 400px;
}

/* ---- Form Elements ---- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-6);
  margin-bottom: 4px;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-7);
}
.form-control:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 2px var(--or-light);
}

/* ---- Toast ---- */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
}
.toast-msg {
  background: var(--gray-7);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Utilities ---- */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
.gap-16     { gap: 16px; }
.gap-20     { gap: 20px; }
.mb-8       { margin-bottom: 8px; }
.mb-12      { margin-bottom: 12px; }
.mb-16      { margin-bottom: 16px; }
.mb-20      { margin-bottom: 20px; }
.mt-16      { margin-top: 16px; }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.fw-700     { font-weight: 700; }
.fs-12      { font-size: 12px; }
.fs-13      { font-size: 13px; }
.color-or   { color: var(--or-dark); }
.color-gray { color: var(--gray-5); }
.w-full     { width: 100%; }
.hidden     { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .screen-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .screen-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
}
