/**
 * LOCUS. Storage System
 * Professional SaaS Design v2
 */

/* ==================== CSS VARIABLES ==================== */
:root {
  /* Primary Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  /* Status Colors */
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;
  --info: #0284c7;

  /* Grays */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Sidebar */
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #334155;
  --sidebar-active: #3b82f6;

  /* Layout */
  --sidebar-width: 256px;
  --header-height: 64px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Radius */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
}

/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

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

.cursor-pointer {
  cursor: pointer;
}

/* ==================== LAYOUT ==================== */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.logo-text {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group-title {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-text);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-item-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-item-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-info:hover {
  background: var(--sidebar-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-name {
  color: #fff;
  font-weight: 500;
}

.user-role {
  color: var(--sidebar-text);
  font-size: 12px;
}

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

.header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.header-subtitle {
  color: var(--gray-500);
  font-size: 14px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.content {
  flex: 1;
  padding: 24px;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}

.btn-ghost:hover {
  background: var(--gray-100);
}

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

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

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

/* ==================== CARDS ==================== */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* ==================== TABLES ==================== */
.table-container {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.table-title {
  font-size: 16px;
  font-weight: 600;
}

.table-actions {
  display: flex;
  gap: 8px;
}

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

th {
  text-align: left;
  padding: 12px 16px;
  background: var(--gray-50);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.1s ease;
}

tbody tr:hover {
  background: var(--gray-50);
}

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

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--gray-500);
}

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-gray {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-gray .badge-dot {
  background: var(--gray-400);
}

.badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.badge-yellow .badge-dot {
  background: #f59e0b;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-green .badge-dot {
  background: #22c55e;
}

.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

.badge-blue .badge-dot {
  background: #3b82f6;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-red .badge-dot {
  background: #ef4444;
}

/* Category Tag */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-draft {
  background: #fef3c7;
  color: #92400e;
}

.status-posted {
  background: #dcfce7;
  color: #166534;
}

.status-canceled {
  background: #fee2e2;
  color: #991b1b;
}

.status-pending {
  background: #dbeafe;
  color: #1e40af;
}

.status-active {
  background: #d1fae5;
  color: #065f46;
}

/* Not Found Row (Inventory) */
.not-found-row {
  background: #fef9c3 !important;
  opacity: 0.7;
}

.not-found-row td {
  text-decoration: line-through;
  color: var(--gray-500);
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: #fff;
  color: var(--gray-900);
  transition: all 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-input-sm {
  padding: 8px 10px;
  font-size: 13px;
}

/* Inline editable */
.inline-input {
  border: 1px solid transparent;
  padding: 8px;
  border-radius: var(--radius);
  background: transparent;
  transition: all 0.15s ease;
}

.inline-input:hover {
  background: var(--gray-50);
}

.inline-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Empty/Warning Input */
.inline-input.empty {
  border-color: var(--warning);
  background: #fffbeb;
}

.inline-input.empty:focus {
  border-color: var(--warning);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.15);
}

/* Hide number input spinners */
.no-spinners::-webkit-outer-spin-button,
.no-spinners::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spinners {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Inline Loading */
.inline-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius);
  color: var(--primary);
  font-weight: 500;
}

.inline-loading .spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* Search */
.search-box {
  position: relative;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  padding: 24px;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
}

.modal-backdrop.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--gray-500);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--gray-100);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==================== LOADING ==================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-700);
}

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.2s ease;
  max-width: 360px;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== DETAIL PAGE ==================== */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  color: var(--gray-500);
  padding: 8px;
  border-radius: var(--radius);
}

.back-btn:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.page-title {
  font-size: 24px;
  font-weight: 600;
}

.page-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

/* Image Gallery */
.gallery {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.gallery-main {
  aspect-ratio: 4/3;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-main img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--gray-200);
  overflow-x: auto;
}

.gallery-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  object-fit: cover;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.gallery-thumb:hover,
.gallery-thumb.active {
  opacity: 1;
}

.gallery-thumb.active {
  border-color: var(--primary);
}

/* ==================== CAMERA ==================== */
.camera-wrapper {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 3/4;
  position: relative;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
}

.capture-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.capture-btn:active {
  transform: scale(0.9);
}

.captured-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.captured-photo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  object-fit: cover;
  position: relative;
}

.captured-photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-700);
}

.empty-text {
  color: var(--gray-500);
  margin-bottom: 24px;
}

/* ==================== UTILITIES ==================== */
.text-muted {
  color: var(--gray-500);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.cursor-pointer {
  cursor: pointer;
}

/* ==================== RESPONSIVE ==================== */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-700);
  cursor: pointer;
  margin-right: 12px;
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 13px;
  }

  .header {
    padding: 0 16px;
  }

  .content {
    padding: 16px;
  }

  /* Mobile Cards instead of Table */
  .mobile-cards table thead {
    display: none;
  }

  .mobile-cards table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    padding: 16px;
  }

  .mobile-cards table td {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border: none;
  }

  .mobile-cards table td::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--gray-500);
  }

  .modal {
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-body {
    max-height: calc(100vh - 140px);
  }

  /* Mobile-friendly inputs */
  .form-input,
  .form-select {
    min-height: 44px;
    font-size: 16px;
    /* Prevents iOS zoom on focus */
  }

  /* Mobile header actions */
  #headerActions {
    flex-wrap: wrap;
    gap: 8px;
  }

  #headerActions .btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
  }

  /* Invoice list mobile cards */
  .invoice-card {
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
  }

  /* Detail page mobile */
  .detail-container .card {
    margin-bottom: 12px;
  }

  /* Grid layouts on mobile */
  .detail-container [style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  /* Table horizontal scroll container */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Bigger touch targets */
  .btn-sm {
    min-height: 36px;
    min-width: 36px;
    padding: 8px 12px;
  }

  .btn-ghost {
    min-height: 40px;
    min-width: 40px;
  }

  /* Toast positioning on mobile */
  .toast-container {
    left: 16px;
    right: 16px;
    width: auto;
  }

  .toast {
    max-width: 100%;
  }

  /* Recipe detail mobile */
  .recipe-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* Page title smaller on mobile */
  #pageTitle {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50vw;
  }
}

/* Mobile Overlay for Sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

@media (max-width: 1024px) {
  .sidebar.open+.sidebar-overlay {
    display: block;
  }
}

/* User Menu Popover */
.sidebar-footer {
  position: relative;
}

.user-menu-popover {
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 150;
  overflow: hidden;
}

.user-menu-popover.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.popover-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: var(--gray-700);
  transition: background 0.15s;
}

.popover-item:hover {
  background: var(--gray-50);
}

.popover-item.text-danger {
  color: var(--danger);
}

/* ==================== AUTOCOMPLETE ==================== */
.autocomplete-dropdown {
  position: fixed;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  min-width: 200px;
  overflow-y: auto;
  z-index: 9999;
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.1s ease;
}

.autocomplete-item:hover {
  background: var(--gray-100);
}

.autocomplete-item.autocomplete-empty {
  color: var(--gray-500);
  font-style: italic;
  cursor: default;
}

.autocomplete-item.autocomplete-empty:hover {
  background: transparent;
}

.product-autocomplete {
  width: 100%;
}

/* ==================== DISHES TREE VIEW ==================== */
.dishes-tree {
  padding: 8px 0;
}

.tree-folder {
  margin-bottom: 2px;
}

.tree-folder-header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s ease;
  gap: 8px;
}

.tree-folder-header:hover {
  background: var(--gray-100);
}

.tree-toggle {
  width: 16px;
  font-size: 10px;
  color: var(--gray-500);
  text-align: center;
  flex-shrink: 0;
}

.tree-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.tree-name {
  flex: 1;
  font-weight: 500;
  color: var(--gray-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-count {
  font-size: 12px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.tree-action {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.tree-folder-header:hover .tree-action,
.tree-dish:hover .tree-action {
  opacity: 1;
}

.tree-folder-content {
  margin-left: 0;
}

.tree-dish {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s ease;
  gap: 8px;
}

.tree-dish:hover {
  background: var(--gray-50);
}

.tree-dish .tree-name {
  font-weight: 400;
}

.tree-code {
  font-size: 11px;
  color: var(--gray-500);
  font-family: monospace;
  padding: 2px 6px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
}

.tree-price {
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 70px;
  text-align: right;
}

.tree-dish.dragging,
.tree-folder.dragging {
  opacity: 0.4;
}

.tree-folder-header.drag-over,
.tree-folder.drag-over>.tree-folder-header {
  background: var(--primary-light);
  outline: 2px dashed var(--primary);
}

.tree-uncategorized .tree-folder-header {
  background: transparent;
}

.tree-uncategorized .tree-name {
  font-style: italic;
}

/* Drop zones */
.drop-zone {
  height: 0;
  overflow: hidden;
  transition: height 0.15s ease, background 0.15s ease;
  border-radius: var(--radius);
  margin: 0 8px;
}

.drop-zone-before {
  margin-bottom: -2px;
}

.drop-zone-inside {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--primary);
  margin-top: 4px;
}

.drop-zone-active {
  height: 36px;
  background: var(--primary-light);
  border: 2px dashed var(--primary);
}

.drop-zone-active span {
  opacity: 1;
}

.drop-zone span {
  opacity: 0;
  transition: opacity 0.1s ease;
}

/* Highlight animation for drilldown */
@keyframes highlight-fade {
  0% {
    background-color: var(--primary-light);
  }

  100% {
    background-color: transparent;
  }
}

.highlight-pulse {
  background-color: var(--primary-light);
  animation: highlight-fade 3s ease-out forwards;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}