/* BUTTONS - Premium Design System
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 14px;
  font-weight: 600;
  font-size: var(--font-size-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  outline: none;
  position: relative;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: break-word;
  letter-spacing: 0.01em;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Primary - Vibrant Indigo Gradient */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.5), 0 0 40px rgba(99, 102, 241, 0.12);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Secondary - Glass Effect */
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2), 0 4px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

/* Accent - Warm Amber Gradient */
.btn-accent {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  color: #1f2937;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.5), 0 0 40px rgba(245, 158, 11, 0.12);
}

/* Success - Emerald Gradient */
.btn-success {
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.5), 0 0 40px rgba(16, 185, 129, 0.12);
}

.btn-success:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Danger - Rose Gradient */
.btn-danger {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(239, 68, 68, 0.5), 0 0 40px rgba(239, 68, 68, 0.12);
}

/* Warning - Orange Gradient */
.btn-warning {
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 50%, #ea580c 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

/* Info - Blue Gradient */
.btn-info {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.btn-info:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

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

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-md);
}

.btn-block {
  width: 100%;
}

/* Add to Order Button */
.btn-add {
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--primary);
  border-radius: var(--radius-full);
  color: white;
  font-size: var(--font-size-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.btn-add:hover {
  background: var(--primary-hover);
  transform: scale(1.1);
  box-shadow: var(--shadow-glow);
}

.btn-add:active {
  transform: scale(0.95);
}

/* Product Quantity Selector on Card */
.product-qty-selector {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.product-qty-selector .qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-qty-selector .qty-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.product-qty-selector .qty-text {
  font-weight: var(--font-weight-bold);
  min-width: 20px;
  text-align: center;
}

/* ============================================

   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  pointer-events: none;
  width: 100%;
  max-width: 400px;
  padding: 0 var(--space-md);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.2s ease;
  font-size: 14px;
}

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100px);
  }

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

@keyframes toast-out {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

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

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info .toast-icon {
  color: var(--info);
}

.toast-message {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.toast-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.2);
  border: none;
  border-radius: var(--radius-md);
  color: #ef4444;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(239, 68, 68, 0.3);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

/* ============================================

   FORM ELEMENTS
   ============================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #ffffff;
  font-size: var(--font-size-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 4px 16px rgba(99, 102, 241, 0.08);
  background: rgba(255, 255, 255, 0.06);
}

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

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-md) center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: var(--space-2xl);
}

/* Image Upload */
.image-upload {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.image-upload:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.image-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.image-upload-text {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.image-upload-preview {
  position: absolute;
  inset: 0;
}

.image-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: scale-down;
}

.image-upload-remove {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--error);
  border-radius: var(--radius-full);
  color: white;
  z-index: 1;
}

/* ============================================

   MODAL DIALOG
   ============================================ */
/* Consolidated with admin-modernization block below */

.modal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  padding-top: max(var(--space-lg), env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-header h3 {
  font-size: var(--font-size-xl);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  max-height: 90vh;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============================================

   UTILITY CLASSES
   ============================================ */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-xs {
  margin-bottom: var(--space-xs);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.mb-xl {
  margin-bottom: var(--space-xl);
}

.mt-xs {
  margin-top: var(--space-xs);
}

/* ============================================

   LANGUAGE SELECTION MODAL
   ============================================ */
.language-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 13, 0.98);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.language-modal-content {
  max-width: 400px;
  width: 100%;
  padding-bottom: 100px;
}

.language-buttons-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.language-btn-large {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  width: 100%;
  padding: 16px var(--space-lg);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.language-btn-large:hover,
.language-btn-large:active {
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15), 0 0 30px rgba(99, 102, 241, 0.06);
}

.language-flag {
  font-size: 1.75rem;
}

/* ============================================

   LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(90deg,
      var(--bg-tertiary) 25%,
      var(--bg-card) 50%,
      var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

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

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

/* ============================================

   GENERAL CARD IMPROVEMENTS
   ============================================ */
.card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
}

.p-sm {
  padding: var(--space-sm);
}

.p-md {
  padding: var(--space-md);
}

.p-lg {
  padding: var(--space-lg);
}

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

.text-sm {
  font-size: 0.875rem;
}

.text-secondary {
  color: #ffffff;
}

.font-bold {
  font-weight: 700;
}

.border-bottom {
  border-bottom: 1px solid var(--border-color);
}

.pb-xs {
  padding-bottom: var(--space-xs);
}

/* Small Icon Button for Actions */
.btn-icon-small {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-small:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-icon-small.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.order-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ============================================

   PASSWORD VISIBILITY TOGGLE
   ============================================ */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.password-input-wrapper .form-input {
  padding-right: 50px;
  flex: 1;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  z-index: 5;
}

.password-toggle-btn:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}

.password-toggle-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.password-toggle-btn i {
  font-size: 16px;
}

/* Password Section Cards */
.password-section-card {
  transition: all 0.2s ease;
}

.password-section-card:hover {
  border-color: var(--primary);
}

/* Individual Password Items */
#individualChefPasswordsList .form-group,
#individualWaiterPasswordsList .form-group {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

#individualChefPasswordsList .form-group:hover,
#individualWaiterPasswordsList .form-group:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

/* Mobile Adjustments for Passwords Tab */
@media (max-width: 768px) {
  .password-section-card {
    padding: 15px !important;
    max-width: 100% !important;
  }

  #passwordsTab>div:first-child {
    flex-direction: column;
    gap: 15px;
  }

  #passwordsTab>div:first-child .btn {
    width: 100%;
  }

  #individualPasswordsListContainer>div:first-child {
    flex-direction: column;
    align-items: flex-start;
  }

  #individualChefPasswordsList .form-group,
  #individualWaiterPasswordsList .form-group {
    padding: 10px;
  }

  .password-input-wrapper {
    width: 100%;
  }
}

/* ============================================

   PASSWORD VISIBILITY TOGGLE
   ============================================ */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.password-input-wrapper .form-input {
  padding-right: 50px;
  flex: 1;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  z-index: 5;
}

.password-toggle-btn:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}

.password-toggle-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.password-toggle-btn i {
  font-size: 16px;
}

/* Password Section Cards */
.password-section-card {
  transition: all 0.2s ease;
}

.password-section-card:hover {
  border-color: var(--primary);
}

/* Individual Password Items */
#individualChefPasswordsList .form-group,
#individualWaiterPasswordsList .form-group {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

#individualChefPasswordsList .form-group:hover,
#individualWaiterPasswordsList .form-group:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

/* Mobile Adjustments for Passwords Tab */
@media (max-width: 768px) {
  .password-section-card {
    padding: 15px !important;
    max-width: 100% !important;
  }

  #passwordsTab>div:first-child {
    flex-direction: column;
    gap: 15px;
  }

  #passwordsTab>div:first-child .btn {
    width: 100%;
  }

  #individualPasswordsListContainer>div:first-child {
    flex-direction: column;
    align-items: flex-start;
  }

  #individualChefPasswordsList .form-group,
  #individualWaiterPasswordsList .form-group {
    padding: 10px;
  }

  .password-input-wrapper {
    width: 100%;
  }
}

/* ============================================

   NOTIFICATION Z-INDEX FIXES
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20000 !important;
  /* Above everything */
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  /* Allow clicks to pass through container */
}

.toast {
  position: relative;
  background: rgba(8, 10, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  animation: slideInToast 0.3s ease forwards;
  border-left-width: 4px;
  border-left-style: solid;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--error);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg {
  width: 20px;
  height: 20px;
}

.toast-message {
  font-size: 14px;
  font-weight: 500;
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

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

.toast-out {
  animation: slideOutToast 0.3s ease forwards;
}

@keyframes slideOutToast {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Ensure Modals are below Toast */
.modal,
.modal-overlay,
.custom-modal-overlay {
  z-index: 9000 !important;
  /* Ensure modals are below notifications */
}

.modal.active,
.modal-overlay.active,
.custom-modal-overlay.active {
  z-index: 400 !important;
  /* Active modals slightly higher but still below toasts */
}

/* ============================================

   UTILITIES
   ============================================ */
/* Scroll Locking for Modals */
.no-scroll {
  overflow: hidden !important;
  height: 100vh !important;
  touch-action: none;
}
/* MODALS PORTED FROM ADMIN.CSS */


/* ============================================

   ADMIN MODAL - PROPER SIZING & OVERFLOW
   ============================================ */

/* Base modal styles */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 90000;
}

/* Specific z-index to ensure variations modal is always on top of add-item modal */
#waiterProductModal.active {
  z-index: 90010 !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
}

.modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1400px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: rgba(8, 10, 20, 0.95);
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  animation: modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-xl, 16px);
  padding-top: max(var(--space-md), env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  flex-direction: row;
  gap: 33px;
}

.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.modal-body {
  flex: 1;
  padding: var(--space-lg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal-footer {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.modal-footer .btn {
  flex: 1;
}

/* Admin modal specific - wider for forms */
#productModal .modal-content {
  max-width: 1400px;
}

#ingredientModal .modal-content {
  max-width: 600px;
}

/* Mobile modal overrides */
/* Mobile modal overrides */
@media (max-width: 768px) {

  /* Scope the drawer-style modal ONLY to waiter panels to avoid CSS bleed */
  #addItemModal.active,
  #waiterProductModal.active,
  #cartModal.active {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* Shared "Drawer" Content Style for Waiter Modals */
  #addItemModal .modal-content,
  #waiterProductModal .modal-content,
  #cartModal .modal-content {
    width: calc(100% - 24px) !important;
    max-width: 600px !important;
    /* Cap width for better premium feel on larger mobile/tablets */
    height: 90vh !important;
    max-height: 90vh !important;
    min-width: 0 !important;
    /* Fix flex overflow */
    border-radius: var(--radius-2xl) !important;
    margin: 10px !important;
    margin-top: 30px !important;
    /* Added more space at the top as requested */
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4) !important;
    position: relative !important;
    transform: none !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center;
  }

  /* Default modals should stay centered and not bleed */
  .modal:not(#addItemModal):not(#waiterProductModal):not(#cartModal) {
    display: none;
    align-items: center;
    justify-content: center;
  }

  /* Fix Nested Scrollbars on Mobile */
  #addItemModal .modal-body {
    padding: var(--space-md);
    padding-bottom: 70px;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    /* Disable outer scroll */
    height: 100%;
    min-height: 0;
  }

  /* Waiter Product List - The only scrollable area on mobile */
  .waiter-product-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    padding-bottom: var(--space-xl);
    scrollbar-width: none;
    /* Hide scrollbar */
  }

  .waiter-product-list::-webkit-scrollbar {
    display: none;
  }

  .modal:not(#addItemModal):not(#waiterProductModal):not(#cartModal).active {
    display: flex !important;
  }

  /* Stack grids to single column on mobile */
  .modal-body .grid-cols-2,
  .modal-body .grid-cols-3 {
    grid-template-columns: 1fr !important;
  }

  .modal-body .grid {
    gap: var(--space-sm) !important;
  }
}

