/* ============================================================================
   TOP COOKIES - CHAT PAGE STYLES
   Clean production-ready CSS with WhatsApp-style interface
   Mobile-first RTL design for Hebrew
   ============================================================================ */

/* ========== CSS VARIABLES ========== */

:root {
  /* WhatsApp Colors */
  --wa-bg: #efeae2;
  --wa-header: #075e54;
  --wa-incoming: #ffffff;
  --wa-outgoing: #dcf8c6;
  --wa-green: #25d366;
  --wa-border: #d1d7db;

  /* Brand Colors */
  --primary: #d97706;
  --primary-dark: #92400e;
  --text: #111;
  --muted: #667781;
  --shadow: 0 1px 2px rgba(0,0,0,0.1);
  --a11y-scale: 1;

  /* Fluid Spacing Scale */
  --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
  --space-sm: clamp(0.5rem, 1vw, 0.75rem);
  --space-md: clamp(0.75rem, 1.5vw, 1rem);
  --space-lg: clamp(1rem, 2vw, 1.5rem);
  --space-xl: clamp(1.5rem, 3vw, 2rem);
  --space-2xl: clamp(2rem, 4vw, 3rem);
}

/* ========== BASE STYLES ========== */

html {
  direction: rtl;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
  /* Fluid base font size that scales with viewport but stays readable */
  font-size: clamp(14px, 1.5vw, 16px);
}

body {
  font-family: 'Heebo', system-ui, sans-serif;
  background: var(--wa-bg);
  color: var(--text);
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  font-size: 1rem; /* Inherits from html, scales fluidly */
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ========== SCROLLBAR STYLING ========== */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 119, 6, 0.3) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(217, 119, 6, 0.3);
  border-radius: 3px;
  transition: background 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(217, 119, 6, 0.5);
}

/* Hide scrollbar on mobile */
@media (max-width: 599px) {
  *::-webkit-scrollbar {
    display: none;
  }
  * {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
}

/* ========== HEADER (WhatsApp Style) ========== */

.chat-header {
  background: var(--wa-header);
  color: white;
  padding: 4px 8px;
  padding-top: max(6px, calc(env(safe-area-inset-top, 0px) + 6px));
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  z-index: 100;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .header-content {
    gap: 8px;
  }

  .header-content > div:last-child {
    flex-wrap: wrap;
    gap: 6px !important;
  }
}

.reset-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  font-size: 16px;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

.business-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.business-info h1 {
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 600;
  margin: 0;
  line-height: 1.1;
}

.status {
  font-size: clamp(0.65rem, 1.5vw, 0.75rem);
  opacity: 0.85;
  font-weight: 400;
  line-height: 1;
}

/* Mode Switcher */
.mode-switcher {
  margin-left: auto;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 1rem;
  font-size: clamp(0.7rem, 1.8vw, 0.85rem);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.mode-switcher:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
  .mode-switcher {
    font-size: 11px;
    padding: 6px 10px;
    gap: 4px;
  }
}

/* ========== CHAT CONTAINER ========== */

.chat-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-md) var(--space-sm) 150px var(--space-sm);
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, #f5f1e8 0%, #efeae2 100%);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* ========== MESSAGE BUBBLES ========== */

.message {
  display: flex;
  margin-bottom: var(--space-sm);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.incoming {
  justify-content: flex-start;
}

.message.outgoing {
  justify-content: flex-end;
}

.message-bubble {
  background: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  max-width: 90%;
  border: 1px solid rgba(0,0,0,0.05);
}

.message.incoming .message-bubble {
  background: white;
  border-radius: 4px 12px 12px 12px;
}

.message.outgoing .message-bubble {
  background: var(--wa-outgoing);
  border-radius: 12px 4px 12px 12px;
}

.message-text {
  font-size: clamp(0.875rem, 2vw, 1rem);
  line-height: 1.5;
  word-wrap: break-word;
  color: #1f2937;
}

.message-text strong {
  color: var(--primary);
  font-weight: 800;
}

.message-time {
  font-size: clamp(0.65rem, 1.4vw, 0.75rem);
  color: var(--muted);
  margin-top: var(--space-xs);
  text-align: left;
}

/* ========== CATEGORY SELECTOR ========== */

.category-selector {
  max-width: 100%;
  padding: var(--space-md);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 0.75rem;
  margin: var(--space-xs) 0;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
}

.category-chip {
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: var(--space-md) var(--space-xl);
  border-radius: 1.5rem;
  font-size: clamp(0.875rem, 2vw, 1rem);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 2.75rem;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}

.category-chip:active {
  transform: scale(0.96);
}

.category-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* ========== PRODUCT ITEMS ========== */

.product-item {
  background: white;
  padding: var(--space-lg);
  border-radius: 0.75rem;
  display: flex;
  gap: var(--space-lg);
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  margin-bottom: var(--space-md);
  border: 1px solid rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}

.product-item:active {
  transform: scale(0.99);
}

.product-image-wrapper {
  position: relative;
  flex-shrink: 0;
}

.product-image {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f5f5f5, #e5e5e5);
  border: 2px solid #f0f0f0;
}

.product-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.4);
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-weight: 700;
  font-size: clamp(0.9rem, 2.2vw, 1.1rem);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  line-height: 1.4;
  color: #1f2937;
}

.product-allergens {
  font-size: clamp(0.65rem, 1.5vw, 0.75rem);
  color: #dc2626;
  background: #fef2f2;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 0.375rem;
  margin-bottom: var(--space-xs);
  border: 1px solid #fecaca;
  line-height: 1.4;
}

.product-allergens strong {
  color: #991b1b;
  font-weight: 700;
}

.product-price {
  color: var(--primary);
  font-weight: 800;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  margin-bottom: var(--space-sm);
}

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

/* Go to Cart button (appears after adding item) */
.product-actions .quick-add[onclick*="openCartModalFunc"] {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  font-weight: 700;
  transition: all 0.25s ease;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
}

.product-actions .quick-add[onclick*="openCartModalFunc"]:active {
  transform: scale(0.96);
  background: linear-gradient(135deg, #059669, #047857);
}

/* ========== BUTTONS ========== */

.quick-add {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  padding: var(--space-md) var(--space-lg);
  border-radius: 1.5rem;
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all 0.25s ease;
  font-family: inherit;
  min-height: 2.75rem;
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.4);
}

.quick-add:active {
  transform: scale(0.96);
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* ========== QUANTITY CONTROLS ========== */

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 25px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
  border: 2px solid #fbbf24;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.qty-btn:active {
  transform: scale(0.92);
  background: linear-gradient(135deg, #d97706, #b45309);
}

.qty-display {
  min-width: 32px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  color: #92400e;
}

/* ========== BOTTOM BAR ========== */

.bottom-bar {
  position: fixed;
  inset-block-end: 0;
  inset-inline: 0;
  background: white;
  padding: 10px;
  padding-inline: max(16px, env(safe-area-inset-right, 16px)) max(16px, env(safe-area-inset-left, 16px));
  padding-bottom: max(10px, calc(10px + env(safe-area-inset-bottom, 10px)));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  z-index: 99999; /* Increased to ensure always on top */
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  border-top: 1px solid rgba(0,0,0,0.1);
  /* Ensure bar is always visible */
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}

.suggestion-chip {
  background: white;
  border: 1.5px solid #d97706;
  color: #d97706;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  font-family: inherit;
}

.suggestion-chip:hover {
  background: #fff7ed;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.2);
}

.suggestion-chip:active {
  transform: scale(0.96);
}

.suggestion-chip.primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border-color: #d97706;
}

.suggestion-chip.primary:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* Chat Suggestion - WhatsApp bubble style */
.chat-suggestion {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #075e54;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  min-height: 44px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  width: 100%;
}

.chat-suggestion:active {
  transform: scale(0.98);
  background: #f5f5f5;
}

.chat-suggestion.primary {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
  font-size: 15px;
  font-weight: 700;
  padding: 14px 20px;
  min-height: 48px;
}

.chat-suggestion.primary:active {
  transform: scale(0.98);
  background: linear-gradient(135deg, #128c7e, #075e54);
}

/* ========== ACCESSIBILITY WIDGET (Now in Header) ========== */

.a11y-widget {
  display: none !important; /* Hide old floating widget */
}

.a11y-option {
  padding: 8px;
  font-size: 12px;
  min-height: 36px;
  border-radius: 6px;
  background: white;
  border: 1px solid var(--wa-border);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
}

.a11y-option:hover {
  background: var(--wa-bg);
  border-color: var(--primary);
}

/* ========== TOAST NOTIFICATIONS ========== */

.toast {
  position: fixed;
  top: 70px;
  right: 10px;
  background: rgba(16, 185, 129, 0.9);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  transition: opacity 0.2s ease;
  max-width: 200px;
  text-align: center;
  opacity: 0;
}

.toast.show {
  opacity: 0.95;
}

/* ========== SCREEN READER ONLY ========== */

.sr-only,
#live-region {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ========== RESPONSIVE - TABLET ========== */

@media (min-width: 600px) and (max-width: 900px) {
  .chat-container {
    padding: 12px 16px 150px 16px;
  }

  .bottom-bar {
    padding: 14px;
    padding-inline: max(20px, env(safe-area-inset-right, 20px)) max(20px, env(safe-area-inset-left, 20px));
    padding-bottom: max(14px, calc(14px + env(safe-area-inset-bottom, 14px)));
  }

  .product-image {
    width: 100px;
    height: 100px;
  }

  .message-bubble {
    max-width: 80%;
  }
}

/* ========== RESPONSIVE - DESKTOP ========== */

@media (min-width: 900px) {
  .chat-container {
    padding: 16px 20px 150px 20px;
  }

  .header-content {
    width: 100%;
  }

  .bottom-bar {
    width: 100%;
    padding: 16px;
    padding-inline: max(24px, env(safe-area-inset-right, 24px)) max(24px, env(safe-area-inset-left, 24px));
    padding-bottom: max(16px, calc(16px + env(safe-area-inset-bottom, 16px)));
  }

  .product-image {
    width: 110px;
    height: 110px;
  }

  .message-bubble {
    max-width: 75%;
  }

  .a11y-widget {
    top: calc(70px + env(safe-area-inset-top, 0px));
    right: 24px;
  }

  .a11y-panel {
    top: calc(120px + env(safe-area-inset-top, 0px));
    right: 24px;
  }
}

/* ========== MOBILE - SMALL SCREENS ========== */

@media (max-width: 360px) {
  .product-image {
    width: 70px;
    height: 70px;
  }

  .product-name {
    font-size: 13px;
  }

  .product-price {
    font-size: 15px;
  }

  .quick-add {
    font-size: 12px;
    padding: 8px 14px;
  }

  .category-chip {
    font-size: 12px;
    padding: 8px 16px;
  }

  .message-text {
    font-size: 13px;
  }

  .suggestion-chip {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* ========== LANDSCAPE MODE ========== */

@media (max-height: 500px) and (orientation: landscape) {
  .chat-container {
    padding-bottom: 120px;
  }

  .bottom-bar {
    padding: 8px;
    padding-inline: max(12px, env(safe-area-inset-right, 12px)) max(12px, env(safe-area-inset-left, 12px));
    padding-bottom: max(8px, calc(8px + env(safe-area-inset-bottom, 8px)));
  }

  .a11y-widget {
    top: calc(55px + env(safe-area-inset-top, 0px));
  }

  .a11y-panel {
    top: calc(95px + env(safe-area-inset-top, 0px));
  }

  .product-image {
    width: 60px;
    height: 60px;
  }
}

/* ========== iOS SAFE AREA ========== */

@supports (padding: max(0px)) {
  .chat-header {
    padding-top: max(12px, calc(env(safe-area-inset-top) + 12px));
  }

  .bottom-bar {
    padding-inline: max(16px, env(safe-area-inset-right, 16px)) max(16px, env(safe-area-inset-left, 16px));
    padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom, 12px)));
  }

  .a11y-widget {
    top: max(60px, calc(60px + env(safe-area-inset-top)));
  }

  .a11y-panel {
    top: max(110px, calc(110px + env(safe-area-inset-top)));
  }
}

/* ========== LOADING STATE ========== */

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

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

/* ========== MODAL IMPROVEMENTS FOR FOLD 7 ========== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow-y: auto;
}

.modal-content {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 100dvh; /* Use dvh to avoid keyboard issues */
  overflow-y: auto;
  position: relative;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.close-modal {
  background: none;
  border: none;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.close-modal:hover {
  background: #f3f4f6;
}

.close-modal:active {
  transform: scale(0.95);
}

.modal-body {
  padding: 16px;
  max-width: 100%;
  overflow-x: hidden;
}

.modal-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background: white;
  position: sticky;
  bottom: 0;
}

.submit-button {
  width: 100%;
  padding: 14px;
  min-height: 50px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.submit-button:active {
  transform: scale(0.98);
}

/* Form styling */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  min-height: 48px; /* Tap target ≥ 44px */
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px; /* Prevents zoom on iOS */
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #1f2937;
}

.info-note, .warning-note {
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 12px;
}

.info-note {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0c4a6e;
}

.warning-note {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  color: #92400e;
}

/* Cart items list */
.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}

/* ========== SAFE AREA IMPROVEMENTS ========== */

@supports (padding: max(0px)) {
  .chat-container {
    padding-inline: max(8px, env(safe-area-inset-left, 8px)) max(8px, env(safe-area-inset-right, 8px));
  }

  .modal-content {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
}

/* ========== FOLD 7 SPECIFIC (360-904px) ========== */

@media (min-width: 360px) and (max-width: 904px) {
  :root {
    font-size: 16px; /* Ensure base font is at least 16px */
  }

  .chat-container {
    max-width: 100%;
    padding-inline: 8px;
  }

  /* Better tap targets for Fold 7 */
  .category-chip,
  .quick-add,
  .chat-suggestion,
  .suggestion-chip {
    min-height: 44px;
  }

  .qty-btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Better button sizing on Fold */
  .mode-switcher {
    min-height: 44px;
    padding: 10px 14px;
  }

  .reset-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ========== FOLD TRANSFORM FIXES ========== */

/* Prevent fractional rounding issues on fold reflow */
*[style*="transform"], .will-transform {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Reflow trigger class (no-op that forces style recalc) */
.reflow {
  outline: 0 solid transparent;
}
