/* ============================================================
   Fresh Grocers — Global Stylesheet
   Design System: Variables, Reset, Typography, Components
   ============================================================ */

/* ─── 1. CSS Custom Properties ───────────────────────────── */
:root {
  /* Brand Colors */
  --primary:        #28A745;
  --primary-dark:   #1e7e34;
  --primary-light:  #d4edda;
  --secondary:      #FD7E14;
  --secondary-dark: #e06c0b;
  --secondary-light:#fff3cd;
  --blue-dark:      #003D82;
  --blue-light:     #cfe2ff;

  /* Semantic Colors */
  --success:     #198754;
  --success-bg:  #d1e7dd;
  --warning:     #c9970a;
  --warning-bg:  #fff3cd;
  --danger:      #DC3545;
  --danger-bg:   #f8d7da;
  --info:        #0d6efd;
  --info-bg:     #cfe2ff;
  --orange:      #fd7e14;
  --orange-bg:   #ffe5d0;

  /* Neutrals */
  --white:      #ffffff;
  --gray-50:    #F8F9FA;
  --gray-100:   #f1f3f5;
  --gray-200:   #dee2e6;
  --gray-300:   #ced4da;
  --gray-400:   #adb5bd;
  --gray-500:   #6c757d;
  --gray-700:   #495057;
  --gray-900:   #212529;

  /* Text */
  --text:       #212529;
  --text-muted: #6c757d;
  --text-light: #adb5bd;

  /* Typography */
  --font-heading: 'Poppins', sans-serif;
  --font-body:    'Roboto', sans-serif;
  --font-mono:    'Courier New', monospace;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.5rem;
  --space-6:  2rem;
  --space-8:  3rem;
  --space-10: 4rem;

  /* Borders */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 50px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.15);
  --shadow-xl: 0 16px 48px rgba(0,0,0,.18);

  /* Transitions */
  --transition: all 0.3s ease;
  --transition-fast: all 0.15s ease;

  /* Layout */
  --container-max: 1280px;
  --nav-h: 68px;
  --sidebar-w: 260px;
}

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

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

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--gray-50);
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--primary-dark); }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

ul, ol { list-style: none; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

table { border-collapse: collapse; width: 100%; }

/* ─── 3. Typography ───────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--gray-900);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.875rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { margin-bottom: var(--space-3); }
p:last-child { margin-bottom: 0; }

.text-primary   { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-danger    { color: var(--danger) !important; }
.text-success   { color: var(--success) !important; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.fw-600    { font-weight: 600; }
.fw-700    { font-weight: 700; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ─── 4. Layout ───────────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) { .container { padding: 0 var(--space-6); } }

.row    { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.col    { flex: 1; min-width: 0; }
.col-2  { width: calc(50% - var(--space-2)); }
.col-3  { width: calc(33.333% - var(--space-3)); }
.col-4  { width: calc(25% - var(--space-3)); }

.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

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

@media (max-width: 992px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
}

/* Spacing utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-3   { padding: var(--space-3); }
.p-4   { padding: var(--space-4); }
.p-5   { padding: var(--space-5); }
.p-6   { padding: var(--space-6); }
.px-4  { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4  { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8  { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.w-100 { width: 100%; }

.hidden { display: none !important; }
.visible { display: block !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─── 5. Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  user-select: none;
}

.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); color: white; }

.btn--secondary {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}
.btn--secondary:hover { background: var(--secondary-dark); border-color: var(--secondary-dark); color: white; }

.btn--outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn--outline:hover { background: var(--primary); color: white; }

.btn--outline-gray {
  background: transparent;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn--outline-gray:hover { background: var(--gray-100); }

.btn--danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn--danger:hover { background: #b02a37; border-color: #b02a37; color: white; }

.btn--danger-outline { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--danger-outline:hover { background: var(--danger); color: white; }

.btn--dark { background: var(--gray-900); color: white; border-color: var(--gray-900); }
.btn--dark:hover { background: var(--gray-700); color: white; }

.btn--ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn--ghost:hover { background: var(--gray-100); color: var(--text); }

.btn--sm { padding: 0.375rem 0.875rem; font-size: 0.8rem; }
.btn--lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn--xl { padding: 1rem 2rem; font-size: 1.1rem; }
.btn--full { width: 100%; }
.btn--icon { padding: 0.5rem; border-radius: 50%; aspect-ratio: 1; }

/* ─── 6. Forms ────────────────────────────────────────────── */
.form__group { margin-bottom: var(--space-4); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 576px) { .form__row { grid-template-columns: 1fr; } }

.form__label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: var(--space-1);
  font-family: var(--font-heading);
}

.form__label span { color: var(--danger); margin-left: 2px; }

.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition-fast);
  outline: none;
  line-height: 1.5;
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(40,167,69,.15);
}

.form__input::placeholder { color: var(--gray-400); }
.form__input.input--error { border-color: var(--danger); }
.form__input.input--error:focus { box-shadow: 0 0 0 3px rgba(220,53,69,.15); }

.form__textarea { resize: vertical; min-height: 100px; }
.form__select { cursor: pointer; }

.form__error {
  display: block;
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: var(--space-1);
  font-weight: 500;
}

.form__hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: var(--space-1);
}

/* Toggle / Checkbox */
.form__check { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.form__check input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--primary); cursor: pointer; }
.form__check-label { font-size: 0.875rem; color: var(--gray-700); cursor: pointer; user-select: none; }

/* Range slider */
.form__range { width: 100%; accent-color: var(--primary); cursor: pointer; }

/* ─── 7. Cards ────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition);
}

.card--hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
}

.card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--gray-900);
}

.card__body { padding: var(--space-5); }
.card__footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* Metric Card */
.metric-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.metric-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.metric-card__icon--primary   { background: var(--primary-light); }
.metric-card__icon--secondary { background: var(--secondary-light); }
.metric-card__icon--info      { background: var(--info-bg); }
.metric-card__icon--danger    { background: var(--danger-bg); }
.metric-card__icon--warning   { background: var(--warning-bg); }

.metric-card__value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--gray-900);
}

.metric-card__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.metric-card__change {
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 4px;
}

.metric-card__change--up   { color: var(--success); }
.metric-card__change--down { color: var(--danger); }

/* ─── 8. Tables ───────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}

.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--primary); }

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
  color: var(--text);
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }
.table--compact td, .table--compact th { padding: 0.5rem 0.75rem; }
.table--striped tbody tr:nth-child(even) { background: var(--gray-50); }

/* ─── 9. Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-heading);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge--success  { background: var(--success-bg); color: var(--success); }
.badge--warning  { background: var(--warning-bg); color: var(--warning); }
.badge--danger   { background: var(--danger-bg); color: var(--danger); }
.badge--info     { background: var(--info-bg); color: var(--info); }
.badge--orange   { background: var(--orange-bg); color: var(--orange); }
.badge--muted    { background: var(--gray-200); color: var(--gray-500); }
.badge--primary  { background: var(--primary-light); color: var(--primary-dark); }

/* ─── 10. Modals ──────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal--open { display: flex; }

.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: -1;
  animation: fadeIn .2s ease;
}

.modal__dialog {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .25s ease;
  position: relative;
  z-index: 1;
}

.modal__dialog--lg { max-width: 720px; }
.modal__dialog--sm { max-width: 400px; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  background: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.1rem;
}

.modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  border: none;
  font-size: 1.1rem;
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.modal__close:hover { background: var(--gray-200); color: var(--gray-900); }

.modal__body { padding: var(--space-5); }
.modal__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ─── 11. Toast Notifications ─────────────────────────────── */
#toast-container {
  position: fixed;
  top: calc(var(--nav-h) + var(--space-3));
  right: var(--space-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 360px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateX(110%);
  transition: transform 0.3s cubic-bezier(.25,.8,.25,1), opacity 0.3s ease;
  opacity: 0;
  background: white;
  border-left: 4px solid var(--gray-300);
}

.toast--show { transform: translateX(0); opacity: 1; }
.toast--hide { transform: translateX(110%); opacity: 0; }

.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--info    { border-left-color: var(--info); }

.toast__icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast--success .toast__icon { color: var(--success); }
.toast--error   .toast__icon { color: var(--danger); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info    .toast__icon { color: var(--info); }

.toast__msg { flex: 1; line-height: 1.5; color: var(--text); }

.toast__close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast__close:hover { color: var(--gray-700); }

/* ─── 12. Loading Spinners ────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
}

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  gap: var(--space-4);
  color: var(--text-muted);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ─── 13. Stars ───────────────────────────────────────────── */
.stars { display: inline-flex; gap: 2px; }
.star  { font-size: 1rem; }
.star--full  { color: #FFC107; }
.star--half  { color: #FFC107; opacity: 0.7; }
.star--empty { color: var(--gray-300); }

.star-input { display: flex; gap: var(--space-2); }
.star-input label {
  font-size: 1.75rem;
  color: var(--gray-300);
  cursor: pointer;
  transition: color .15s ease;
}
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: #FFC107; }
.star-input { flex-direction: row-reverse; }
.star-input input { display: none; }

/* ─── 14. Pagination ──────────────────────────────────────── */
.pagination { margin-top: var(--space-5); }
.pagination__list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.pagination__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination__btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination__btn--active { background: var(--primary); border-color: var(--primary); color: white; }
.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── 15. Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--text-muted);
}

.empty-state__icon { font-size: 4rem; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state__title { font-size: 1.25rem; font-weight: 600; color: var(--gray-700); margin-bottom: var(--space-2); }
.empty-state__desc { color: var(--text-muted); margin-bottom: var(--space-5); max-width: 360px; margin-left: auto; margin-right: auto; }

/* ─── 16. Alerts ──────────────────────────────────────────── */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: 0.9rem;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.alert--success { background: var(--success-bg); border-color: var(--success); color: #0a3622; }
.alert--warning { background: var(--warning-bg); border-color: var(--warning); color: #664d03; }
.alert--danger  { background: var(--danger-bg); border-color: var(--danger); color: #58151c; }
.alert--info    { background: var(--info-bg); border-color: var(--info); color: #084298; }

/* ─── 17. Divider ─────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--gray-200);
  margin: var(--space-5) 0;
}

.divider--text {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.divider--text::before, .divider--text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ─── 18. Progress Bar ────────────────────────────────────── */
.progress { height: 8px; background: var(--gray-200); border-radius: var(--radius-pill); overflow: hidden; }
.progress__bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}
.progress__bar--warning  { background: var(--warning); }
.progress__bar--danger   { background: var(--danger); }
.progress__bar--info     { background: var(--info); }
.progress__bar--secondary{ background: var(--secondary); }

/* ─── 19. Status Stepper (Order Tracking) ─────────────────── */
.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
  padding: var(--space-4) 0;
}

.stepper__item {
  flex: 1;
  text-align: center;
  position: relative;
}

.stepper__item::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--gray-200);
  z-index: 0;
}

.stepper__item:last-child::before { display: none; }

.stepper__dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-2);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-500);
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.stepper__item--active .stepper__dot {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.stepper__item--done .stepper__dot {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.stepper__item--done::before { background: var(--success); }

.stepper__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stepper__item--active .stepper__label,
.stepper__item--done .stepper__label { color: var(--gray-700); }

/* ─── 20. CSS Bar Chart ───────────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: var(--space-2); height: 150px; padding: var(--space-2) 0; }
.bar-chart__bar {
  flex: 1;
  background: var(--primary-light);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 0.5s ease;
  position: relative;
  min-height: 4px;
  cursor: pointer;
}
.bar-chart__bar:hover { background: var(--primary); }
.bar-chart__bar::after {
  content: attr(data-value);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 2px 0;
}

.bar-chart__labels {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.bar-chart__label {
  flex: 1;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── 21. Pie Chart (CSS-only) ────────────────────────────── */
.pie-legend { display: flex; flex-direction: column; gap: var(--space-2); }
.pie-legend__item { display: flex; align-items: center; gap: var(--space-2); font-size: 0.85rem; }
.pie-legend__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── 22. Search Bar ──────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  background: white;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.75rem 0.4rem 1rem;
  gap: var(--space-2);
  transition: var(--transition-fast);
}

.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(40,167,69,.15); }
.search-bar__input {
  border: none;
  background: none;
  outline: none;
  flex: 1;
  font-size: 0.9rem;
  min-width: 0;
  color: var(--text);
}
.search-bar__input::placeholder { color: var(--gray-400); }
.search-bar__btn { background: var(--primary); border: none; border-radius: var(--radius-pill); color: white; padding: 0.3rem 0.8rem; font-size: 0.85rem; cursor: pointer; transition: var(--transition-fast); }
.search-bar__btn:hover { background: var(--primary-dark); }

/* ─── 23. Product Emoji Card ──────────────────────────────── */
.product-emoji {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.product-emoji--Fruits    { background: linear-gradient(135deg, #fff8e1, #fff3cd); }
.product-emoji--Vegetables{ background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.product-emoji--Dairy     { background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.product-emoji--Bakery    { background: linear-gradient(135deg, #fce4ec, #f8bbd0); }
.product-emoji--Beverages { background: linear-gradient(135deg, #e8eaf6, #c5cae9); }
.product-emoji--Snacks    { background: linear-gradient(135deg, #fff3e0, #ffe0b2); }
.product-emoji--Frozen    { background: linear-gradient(135deg, #e1f5fe, #b3e5fc); }
.product-emoji--Household { background: linear-gradient(135deg, #f3e5f5, #e1bee7); }

/* ─── 24. Misc ────────────────────────────────────────────── */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--primary-dark);
  font-size: 1rem;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}

.avatar--lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar--xl { width: 72px; height: 72px; font-size: 1.5rem; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  gap: var(--space-1);
}

.tag--remove { cursor: pointer; color: var(--danger); }
.tag--remove:hover { background: var(--danger-bg); }

/* ─── 25. Animations ──────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse   { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes bounce  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.animate-fadeIn  { animation: fadeIn .3s ease; }
.animate-slideUp { animation: slideUp .3s ease; }

/* ─── 26. Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --nav-h: 60px; }
  .hide-mobile  { display: none !important; }
  .modal__dialog { margin: var(--space-4); }
  .modal { padding: var(--space-3); }
  .card__body { padding: var(--space-4); }
  .metric-card { padding: var(--space-4); gap: var(--space-3); }
  .metric-card__value { font-size: 1.5rem; }
  #toast-container { left: var(--space-3); right: var(--space-3); top: calc(var(--nav-h) + var(--space-3)); max-width: 100%; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

@media print {
  .no-print { display: none !important; }
}
