/* ============================================================
   OrderDash Component Library
   Version: 1.0.0
   
   Reusable component styles shared across all OrderDash modules.
   All components use CSS custom properties for automatic
   light/dark mode support.
   
   Dependencies: design-system.css, animations.css
   ============================================================ */

/* ============================================================
   1. BUTTONS
   ============================================================ */

/* Base button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 10px 20px;
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Primary */
.btn-primary {
  background-color: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  background-color: var(--primary-active);
}

/* Secondary */
.btn-secondary {
  background-color: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--surface-raised);
  border-color: var(--border-strong);
}

.btn-secondary:active:not(:disabled) {
  background-color: var(--surface-overlay);
}

/* Ghost */
.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--surface-raised);
  color: var(--text-primary);
}

.btn-ghost:active:not(:disabled) {
  background-color: var(--surface-overlay);
}

/* Danger */
.btn-danger {
  background-color: var(--error);
  color: #FFFFFF;
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--error-hover);
  border-color: var(--error-hover);
  box-shadow: var(--shadow-md);
}

/* Outline Primary */
.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--primary-light);
}

/* Sizes */
.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-caption);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--text-h4);
  border-radius: var(--radius-md);
}

.btn-xl {
  padding: 16px 32px;
  font-size: var(--text-h4);
  font-weight: 600;
  border-radius: var(--radius-lg);
}

/* Icon-only button */
.btn-icon {
  padding: 10px;
  min-width: 40px;
  min-height: 40px;
}

.btn-icon.btn-sm {
  padding: 6px;
  min-width: 32px;
  min-height: 32px;
}

.btn-icon.btn-lg {
  padding: 14px;
  min-width: 48px;
  min-height: 48px;
}

/* Full width */
.btn-block {
  width: 100%;
}

/* Disabled */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading state */
.btn-loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-top: -9px;
  margin-left: -9px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-primary.btn-loading::after {
  border-top-color: var(--text-on-primary);
  border-right-color: var(--text-on-primary);
}

.btn-secondary.btn-loading::after,
.btn-ghost.btn-loading::after {
  border-top-color: var(--text-primary);
  border-right-color: var(--text-primary);
}

/* Button group */
.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.btn-group .btn + .btn {
  margin-left: -1px;
}


/* ============================================================
   2. CARD
   ============================================================ */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.card-clickable:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.card-body {
  /* Default spacing handled by card padding */
}

.card-footer {
  padding-top: var(--space-2);
  margin-top: var(--space-2);
  border-top: 1px solid var(--border);
}

/* Card flush — no padding */
.card-flush {
  padding: 0;
}

/* Card variants */
.card-raised {
  background-color: var(--surface-raised);
}

.card-bordered {
  box-shadow: none;
  border: 1px solid var(--border);
}


/* ============================================================
   3. MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 15, 20, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-3);
  animation: overlayFadeIn 300ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.modal-overlay[data-closing="true"] {
  animation: fadeIn 200ms cubic-bezier(0.4, 0, 0.2, 1) reverse both;
}

.modal {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
}

.modal[data-closing="true"] {
  animation: scaleOut 200ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.modal-sm {
  max-width: 400px;
}

.modal-lg {
  max-width: 680px;
}

.modal-xl {
  max-width: 900px;
}

.modal-full {
  max-width: calc(100vw - var(--space-6));
  max-height: calc(100vh - var(--space-6));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-h4);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  border: none;
  background: none;
}

.modal-close:hover {
  background-color: var(--surface-overlay);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-3);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}


/* ============================================================
   4. INPUT & FORMS
   ============================================================ */
.input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-body);
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background-color var(--transition-fast);
  outline: none;
  line-height: 1.5;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:hover:not(:focus):not(:disabled):not(.input-error) {
  border-color: var(--border-strong);
}

.input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--surface-raised);
}

/* Input sizes */
.input-sm {
  padding: 6px 10px;
  font-size: var(--text-caption);
}

.input-lg {
  padding: 14px 18px;
  font-size: var(--text-h4);
}

/* Input error state */
.input-error,
.input.is-error {
  border-color: var(--error);
}

.input-error:focus,
.input.is-error:focus {
  border-color: var(--error);
  box-shadow: var(--shadow-error-focus);
}

/* Textarea */
textarea.input {
  min-height: 100px;
  resize: vertical;
}

/* Input group */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.input-label {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

.input-label-required::after {
  content: ' *';
  color: var(--error);
}

.input-helper {
  font-size: var(--text-small);
  color: var(--text-muted);
  margin-top: 2px;
}

.input-error-message {
  font-size: var(--text-small);
  color: var(--error);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Input with icon */
.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .input {
  padding-left: 40px;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.input-icon-wrapper--right .input {
  padding-left: 14px;
  padding-right: 40px;
}

.input-icon-wrapper--right .input-icon {
  left: auto;
  right: 12px;
}


/* ============================================================
   5. SELECT
   ============================================================ */
.select {
  display: block;
  width: 100%;
  padding: 10px 40px 10px 14px;
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-body);
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6B80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  outline: none;
}

.select:hover:not(:focus):not(:disabled) {
  border-color: var(--border-strong);
}

.select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--surface-raised);
}

[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239898AC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}


/* ============================================================
   6. TOGGLE SWITCH
   ============================================================ */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  position: absolute;
  display: none !important;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--border-strong);
  border-radius: 9999px;
  transition: background-color var(--transition-base);
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #FFFFFF;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base),
              background-color var(--transition-base);
}

.toggle-switch input:checked + .toggle-track {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: var(--shadow-focus);
}

.toggle-switch input:disabled + .toggle-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-label {
  font-size: var(--text-body);
  font-weight: 400;
  color: var(--text-primary);
}

/* Small toggle */
.toggle-switch--sm .toggle-track {
  width: 36px;
  height: 20px;
}

.toggle-switch--sm .toggle-track::after {
  width: 16px;
  height: 16px;
}

.toggle-switch--sm input:checked + .toggle-track::after {
  transform: translateX(16px);
}


/* ============================================================
   7. BADGE
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  background-color: var(--neutral-light);
  color: var(--neutral);
}

.badge-success {
  background-color: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background-color: var(--warning-light);
  color: var(--warning);
}

.badge-error {
  background-color: var(--error-light);
  color: var(--error);
}

.badge-info {
  background-color: var(--info-light);
  color: var(--info);
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Solid badges */
.badge-solid {
  color: #FFFFFF;
}

.badge-solid.badge-success {
  background-color: var(--success);
}

.badge-solid.badge-warning {
  background-color: var(--warning);
  color: #1A1A2E;
}

.badge-solid.badge-error {
  background-color: var(--error);
}

.badge-solid.badge-info {
  background-color: var(--info);
}

.badge-solid.badge-primary {
  background-color: var(--primary);
}

/* Badge with dot */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  flex-shrink: 0;
}

/* Badge sizes */
.badge-lg {
  padding: 4px 14px;
  font-size: var(--text-caption);
}


/* ============================================================
   8. TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  pointer-events: none;
  max-width: 420px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1-5);
  padding: var(--space-2);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: slideInToast 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: auto;
  position: relative;
}

.toast-dismissing {
  animation: slideOutToast 300ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.toast-message {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  border: none;
  background: none;
}

.toast-close:hover {
  background-color: var(--surface-overlay);
  color: var(--text-primary);
}

/* Toast progress bar (auto-dismiss timer) */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: progress linear both;
}

/* Toast variants (left border accent) */
.toast-success {
  border-left: 3px solid var(--success);
}
.toast-success .toast-icon { color: var(--success); }
.toast-success .toast-progress { background-color: var(--success); }

.toast-error {
  border-left: 3px solid var(--error);
}
.toast-error .toast-icon { color: var(--error); }
.toast-error .toast-progress { background-color: var(--error); }

.toast-warning {
  border-left: 3px solid var(--warning);
}
.toast-warning .toast-icon { color: var(--warning); }
.toast-warning .toast-progress { background-color: var(--warning); }

.toast-info {
  border-left: 3px solid var(--info);
}
.toast-info .toast-icon { color: var(--info); }
.toast-info .toast-progress { background-color: var(--info); }


/* ============================================================
   9. CHIP / TAG
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: all var(--transition-fast);
  cursor: default;
}

.chip-interactive {
  cursor: pointer;
}

.chip-interactive:hover {
  background-color: var(--surface-overlay);
  border-color: var(--border-strong);
}

.chip-active,
.chip-interactive.chip-active {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  border: none;
  background: none;
  color: inherit;
  font-size: 14px;
  line-height: 1;
}

.chip-remove:hover {
  background-color: var(--error-light);
  color: var(--error);
}

/* Tag — semantic alias */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--primary);
  background-color: var(--primary-light);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}


/* ============================================================
   10. TABS
   ============================================================ */
.tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1-5) var(--space-2);
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast),
              border-color var(--transition-fast);
  margin-bottom: -1px;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active,
.tab-item[aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* Tab badge/count */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: var(--text-small);
  font-weight: 600;
  background-color: var(--surface-overlay);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
}

.tab-item.active .tab-count {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Pill-style tabs */
.tabs-pills {
  border-bottom: none;
  gap: var(--space-0-5);
  background-color: var(--surface-raised);
  border-radius: var(--radius);
  padding: 4px;
}

.tabs-pills .tab-item {
  border-bottom: none;
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  padding: var(--space-1) var(--space-2);
}

.tabs-pills .tab-item.active {
  background-color: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}


/* ============================================================
   11. SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 260px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: width var(--transition-medium),
              transform var(--transition-medium);
  overflow: hidden;
}

.sidebar-collapsed {
  width: 72px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-2);
  height: 64px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  font-size: var(--text-h4);
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-logo span {
  display: none;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  border: none;
  background: none;
}

.sidebar-toggle:hover {
  background-color: var(--surface-overlay);
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-1);
}

.sidebar-section {
  margin-bottom: var(--space-1);
}

.sidebar-section-title {
  padding: var(--space-1) var(--space-1-5);
  font-size: var(--text-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-section-title {
  text-align: center;
  font-size: 0;
}

.sidebar-collapsed .sidebar-section-title::after {
  content: '•••';
  font-size: var(--text-small);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1) var(--space-1-5);
  font-size: var(--text-body);
  font-weight: 400;
  color: var(--text-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}

.sidebar-link:hover {
  background-color: var(--surface-raised);
  color: var(--text-primary);
}

.sidebar-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.sidebar-link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-collapsed .sidebar-link-text {
  display: none;
}

.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: var(--space-1);
}

.sidebar-footer {
  padding: var(--space-2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Mobile sidebar overlay */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: var(--z-overlay);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 15, 20, 0.5);
    z-index: calc(var(--z-overlay) - 1);
    animation: fadeIn 200ms ease both;
  }
}


/* ============================================================
   12. TOPBAR
   ============================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3);
  z-index: var(--z-sticky);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .topbar {
  background-color: rgba(15, 15, 20, 0.85);
}

/* When sidebar is present */
.topbar-with-sidebar {
  left: 260px;
  transition: left var(--transition-medium);
}

.sidebar-collapsed ~ .topbar-with-sidebar,
.sidebar-collapsed ~ * .topbar-with-sidebar {
  left: 72px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
}

.topbar-title {
  font-size: var(--text-h4);
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-subtitle {
  font-size: var(--text-caption);
  color: var(--text-muted);
}


/* ============================================================
   13. AVATAR
   ============================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: var(--text-body);
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sizes */
.avatar-xs {
  width: 24px;
  height: 24px;
  font-size: var(--text-small);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-caption);
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-h4);
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: var(--text-h2);
}

/* Avatar with status indicator */
.avatar-wrapper {
  position: relative;
  display: inline-flex;
}

.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background-color: var(--success);
}

.avatar-status-offline {
  background-color: var(--text-muted);
}

.avatar-status-busy {
  background-color: var(--error);
}

.avatar-status-away {
  background-color: var(--warning);
}

/* Avatar group (stacked) */
.avatar-group {
  display: flex;
  flex-direction: row-reverse;
}

.avatar-group .avatar {
  border: 2px solid var(--surface);
  margin-right: -8px;
}

.avatar-group .avatar:first-child {
  margin-right: 0;
}


/* ============================================================
   14. SKELETON LOADER
   ============================================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-raised) 25%,
    var(--surface-overlay) 37%,
    var(--surface-raised) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

.skeleton * {
  visibility: hidden;
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-1);
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-heading {
  height: 24px;
  width: 50%;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

.skeleton-avatar-lg {
  width: 56px;
  height: 56px;
}

.skeleton-btn {
  height: 40px;
  width: 120px;
  border-radius: var(--radius);
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
}

.skeleton-image {
  height: 180px;
  border-radius: var(--radius-lg);
}


/* ============================================================
   15. EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-3);
  max-width: 400px;
  margin: 0 auto;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-3);
  color: var(--text-muted);
  opacity: 0.6;
}

.empty-state-title {
  font-size: var(--text-h4);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.empty-state-description {
  font-size: var(--text-body);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  line-height: var(--leading-relaxed);
}

.empty-state-action {
  margin-top: var(--space-1);
}


/* ============================================================
   16. DROPDOWN
   ============================================================ */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-0-5);
  z-index: var(--z-dropdown);
  animation: fadeInScaleUp 200ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-origin: top left;
}

.dropdown-menu-right {
  left: auto;
  right: 0;
  transform-origin: top right;
}

.dropdown-menu-up {
  top: auto;
  bottom: calc(100% + 4px);
  transform-origin: bottom left;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-1) var(--space-1-5);
  font-size: var(--text-body);
  font-weight: 400;
  color: var(--text-primary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  border: none;
  background: none;
  text-align: left;
  white-space: nowrap;
}

.dropdown-item:hover {
  background-color: var(--surface-raised);
}

.dropdown-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.dropdown-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.dropdown-item:hover .dropdown-item-icon {
  color: var(--text-secondary);
}

.dropdown-item-danger {
  color: var(--error);
}

.dropdown-item-danger .dropdown-item-icon {
  color: var(--error);
}

.dropdown-item-danger:hover {
  background-color: var(--error-light);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border);
  margin: var(--space-0-5) 0;
}

.dropdown-header {
  padding: var(--space-1) var(--space-1-5);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ============================================================
   17. PROGRESS BAR
   ============================================================ */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--surface-overlay);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-bar-sm {
  height: 4px;
}

.progress-bar-lg {
  height: 12px;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: var(--radius-pill);
  transition: width var(--transition-slow);
  position: relative;
}

/* Gradient fill */
.progress-fill-gradient {
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
}

/* Color variants */
.progress-fill-success { background-color: var(--success); }
.progress-fill-warning { background-color: var(--warning); }
.progress-fill-error   { background-color: var(--error); }
.progress-fill-info    { background-color: var(--info); }

/* Indeterminate (animated) */
.progress-bar-indeterminate .progress-fill {
  position: absolute;
  width: 30%;
  animation: progressIndeterminate 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* With label */
.progress-with-label {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
}

.progress-label {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 40px;
  text-align: right;
}


/* ============================================================
   18. DIVIDER
   ============================================================ */
.divider {
  height: 1px;
  width: 100%;
  background-color: var(--border);
  border: none;
  margin: var(--space-3) 0;
}

.divider-sm {
  margin: var(--space-2) 0;
}

.divider-lg {
  margin: var(--space-4) 0;
}

/* Divider with text */
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-caption);
  font-weight: 500;
  margin: var(--space-3) 0;
}

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

/* Vertical divider */
.divider-vertical {
  width: 1px;
  height: auto;
  align-self: stretch;
  margin: 0 var(--space-2);
  background-color: var(--border);
}


/* ============================================================
   19. SEARCH INPUT
   ============================================================ */
.search-input {
  position: relative;
  width: 100%;
}

.search-input .input {
  padding-left: 40px;
  padding-right: 14px;
}

.search-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.search-input .input:focus ~ .search-input-icon,
.search-input .input:focus + .search-input-icon {
  color: var(--primary);
}

.search-input-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  opacity: 0;
}

.search-input .input:not(:placeholder-shown) ~ .search-input-clear {
  opacity: 1;
}

.search-input-clear:hover {
  background-color: var(--surface-overlay);
  color: var(--text-primary);
}

/* Compact search */
.search-input-compact .input {
  padding: 6px 10px 6px 34px;
  font-size: var(--text-caption);
  border-radius: var(--radius-pill);
  background-color: var(--surface-raised);
  border-color: transparent;
}

.search-input-compact .input:focus {
  background-color: var(--surface);
  border-color: var(--primary);
}

.search-input-compact .search-input-icon {
  left: 10px;
  width: 16px;
  height: 16px;
}


/* ============================================================
   20. NOTIFICATION BELL
   ============================================================ */
.notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
}

.notification-bell:hover {
  background-color: var(--surface-raised);
  color: var(--text-primary);
}

.notification-bell-icon {
  width: 22px;
  height: 22px;
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  background-color: var(--error);
  border-radius: var(--radius-pill);
  border: 2px solid var(--surface);
  line-height: 1;
}

/* Ping effect when new notifications */
.notification-bell-active .notification-badge::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-pill);
  background-color: var(--error);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  opacity: 0.5;
  z-index: -1;
}

/* Dot-only variant (no count) */
.notification-dot-only .notification-badge {
  min-width: 10px;
  height: 10px;
  padding: 0;
  top: 6px;
  right: 6px;
}


/* ============================================================
   21. STATUS DOT
   ============================================================ */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
}

.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neutral);
  flex-shrink: 0;
}

.status-dot-success::before { background-color: var(--success); }
.status-dot-warning::before { background-color: var(--warning); }
.status-dot-error::before   { background-color: var(--error); }
.status-dot-info::before    { background-color: var(--info); }
.status-dot-primary::before { background-color: var(--primary); }

/* Pulsing active dot */
.status-dot-pulse::before {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Larger status dot */
.status-dot-lg::before {
  width: 10px;
  height: 10px;
}


/* ============================================================
   22. DATA TABLE
   ============================================================ */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body);
}

.table th {
  padding: var(--space-1-5) var(--space-2);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  background-color: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table td {
  padding: var(--space-1-5) var(--space-2);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

/* Striped rows */
.table-striped tbody tr:nth-child(even) {
  background-color: var(--surface-raised);
}

/* Hover rows */
.table-hover tbody tr {
  transition: background-color var(--transition-fast);
}

.table-hover tbody tr:hover {
  background-color: var(--primary-subtle);
}

/* Clickable rows */
.table-clickable tbody tr {
  cursor: pointer;
}

/* Compact table */
.table-compact th,
.table-compact td {
  padding: var(--space-1) var(--space-1-5);
  font-size: var(--text-caption);
}

/* Sortable header */
.table-sortable th {
  cursor: pointer;
  transition: color var(--transition-fast);
}

.table-sortable th:hover {
  color: var(--text-primary);
}

.table-sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.3;
  transition: opacity var(--transition-fast);
}

.table-sortable th:hover .table-sort-icon {
  opacity: 0.6;
}

.table-sortable th.sorted .table-sort-icon {
  opacity: 1;
  color: var(--primary);
}

/* Selected row */
.table tbody tr.selected {
  background-color: var(--primary-light);
}

/* Table cell alignment */
.table .cell-right { text-align: right; }
.table .cell-center { text-align: center; }
.table .cell-nowrap { white-space: nowrap; }

/* Table footer */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1-5) var(--space-2);
  border-top: 1px solid var(--border);
  background-color: var(--surface-raised);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

/* Checkbox column */
.table .cell-checkbox {
  width: 40px;
  text-align: center;
}

.table-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-checkbox:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.table-checkbox:checked::after {
  content: '';
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.table-checkbox:focus-visible {
  box-shadow: var(--shadow-focus);
}

/* Empty table state */
.table-empty {
  text-align: center;
  padding: var(--space-6) var(--space-3) !important;
  color: var(--text-muted);
}


/* ============================================================
   CHECKBOX & RADIO (General purpose)
   ============================================================ */
.checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface);
  flex-shrink: 0;
}

.checkbox-wrapper input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: 12px;
  background-repeat: no-repeat;
  background-position: center;
}

.checkbox-wrapper input[type="checkbox"]:focus-visible {
  box-shadow: var(--shadow-focus);
}

.checkbox-label {
  font-size: var(--text-body);
  color: var(--text-primary);
}


/* ============================================================
   TOOLTIP (CSS-only)
   ============================================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 10px;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-on-primary);
  background-color: var(--text-primary);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast),
              transform var(--transition-fast);
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ============================================================
   SCROLL AREA (Custom scrollbar container)
   ============================================================ */
.scroll-area {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.scroll-area::-webkit-scrollbar {
  width: 6px;
}

.scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 9999px;
}

.scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Premium Loading Spinner & Container */
.premium-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(139, 92, 246, 0.15);
  border-top-color: var(--primary, #8b5cf6);
  border-right-color: var(--primary, #8b5cf6);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.premium-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 0.75rem;
  width: 100%;
}

/* ────────────────────────────────────────────────────────────
   23. PREMIUM INTERACTIVE COMPONENTS (REVAMP)
   ──────────────────────────────────────────────────────────── */

/* Toggle Switch Visual Anim */
.toggle-switch input:checked + .toggle-track {
  background: var(--primary) !important;
}
.toggle-switch input:checked ~ .toggle-thumb {
  transform: translateX(16px) !important;
  background-color: #ffffff !important;
}

/* Dining Zone & Menu Category Items */
.location-item, .category-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0.25rem;
}
.location-item:hover, .category-item:hover {
  background: var(--surface-overlay);
  border-color: var(--primary-hover);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.location-item.active, .category-item.active {
  background: var(--primary-light) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
}

/* Hover Scale & Premium Transitions */
.hover-scale {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-scale:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md) !important;
}

.hover-lift {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg) !important;
  border-color: var(--primary-hover) !important;
}

/* Settings Helper Text Info Tooltip */
.input-helper-text {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: var(--leading-normal);
}

/* Custom interactive hover helpers */
.hover-primary:hover:not(:disabled) {
  background-color: var(--primary-light) !important;
  color: var(--primary) !important;
}
.hover-primary:hover:not(:disabled) i,
.hover-primary:hover:not(:disabled) svg {
  color: var(--primary) !important;
}

.hover-error:hover:not(:disabled) {
  background-color: var(--error-light) !important;
  color: var(--error) !important;
}
.hover-error:hover:not(:disabled) i,
.hover-error:hover:not(:disabled) svg {
  color: var(--error) !important;
}

