/* MOBILE-FIRST RESPONSIVE CSS STYLESHEET - LA ARROCERÍA COLOMBIANA (SCROLL FIX) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800;900&display=swap');

:root {
  --primary-red: #D32F2F;
  --primary-red-hover: #B71C1C;
  --accent-gold: #FFB300;
  --accent-gold-dark: #FF8F00;
  --bg-dark: #121214;
  --bg-kiosk: #F4F5F8;
  --card-bg: #FFFFFF;
  --text-dark: #1A1A1E;
  --text-muted: #6C757D;
  --border-light: #E2E8F0;
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.15);
  --shadow-touch: 0 8px 24px rgba(211, 47, 47, 0.3);
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-main: 'Outfit', sans-serif;
}

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

html, body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-dark);
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

/* Base Viewport - Mobile First Layout */
.kiosk-viewport {
  width: 100%;
  min-height: 100vh;
  height: 100dvh;
  background-color: var(--bg-kiosk);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   1. SCREENSAVER (Fixed Overlay)
   ========================================================================== */
.screensaver-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: linear-gradient(135deg, #1A1A24 0%, #000000 100%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 40px 20px;
  color: white;
  text-align: center;
  cursor: pointer;
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screensaver-overlay.hidden { display: none !important; }

.screensaver-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.screensaver-logo-badge {
  width: 90px;
  height: 90px;
  background: var(--primary-red);
  border: 3px solid var(--accent-gold);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.8rem;
  box-shadow: 0 0 25px rgba(211, 47, 47, 0.6);
}

.screensaver-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #FFFFFF, var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.screensaver-subtitle {
  font-size: 1.1rem;
  color: #D1D5DB;
  font-weight: 400;
}

.screensaver-promo-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.promo-badge-tag {
  align-self: flex-start;
  background: var(--accent-gold);
  color: #000;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.touch-prompt-btn {
  background: linear-gradient(90deg, var(--primary-red), #E53935);
  color: white;
  font-size: 1.3rem;
  font-weight: 800;
  padding: 18px 36px;
  border-radius: 40px;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 8px 24px rgba(211, 47, 47, 0.6);
  animation: pulseTouch 2s infinite;
}

@keyframes pulseTouch {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   2. ORDER MODE MODAL (Fixed Overlay)
   ========================================================================== */
.order-mode-modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 900;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-y: auto;
}

.order-mode-modal.hidden { display: none !important; }

.order-mode-card {
  background: white;
  border-radius: 24px;
  padding: 28px 20px;
  width: 100%;
  max-width: 500px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.order-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.mode-option-btn {
  background: #F8F9FA;
  border: 2px solid var(--border-light);
  border-radius: 20px;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-option-btn:active, .mode-option-btn.selected {
  border-color: var(--primary-red);
  background: #FFF5F5;
  box-shadow: var(--shadow-touch);
}

.mode-icon { font-size: 2.8rem; }
.mode-title { font-size: 1.2rem; font-weight: 800; color: var(--text-dark); }

/* ==========================================================================
   3. HEADER BAR
   ========================================================================== */
.kiosk-header {
  height: 64px;
  background: var(--bg-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 3px solid var(--primary-red);
  z-index: 100;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-circle {
  width: 38px;
  height: 38px;
  background: var(--primary-red);
  border: 2px solid var(--accent-gold);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.1;
}

.brand-text p {
  font-size: 0.7rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-type-pill {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.kds-toggle-btn {
  background: rgba(255, 179, 0, 0.2);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

/* ==========================================================================
   4. MAIN KIOSK LAYOUT & SCROLLABLE CONTENT (Mobile First)
   ========================================================================== */
.kiosk-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  height: calc(100% - 64px);
}

/* Category Navigation (Horizontal Scrollable) */
.category-sidebar {
  width: 100%;
  background: white;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 10px 12px;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;
}
.category-sidebar::-webkit-scrollbar { display: none; }

.category-nav-item {
  flex-shrink: 0;
  padding: 8px 16px;
  background: #F8F9FA;
  border: 1.5px solid var(--border-light);
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.category-nav-item.active {
  background: var(--primary-red);
  color: white;
  border-color: var(--accent-gold);
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.category-nav-item .cat-icon { font-size: 1.2rem; }
.category-nav-item .cat-label { font-size: 0.85rem; font-weight: 800; }

/* Products Section (SCROLLABLE CONTAINER) */
.products-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 110px; /* Generous bottom spacing for floating cart bar */
}

.category-header-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr; /* 1 Column on Mobile */
  gap: 14px;
}

/* Product Card */
.product-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: row;
  min-height: 120px;
  cursor: pointer;
  position: relative;
}

.product-card:active {
  transform: scale(0.98);
  border-color: var(--primary-red);
}

.product-thumb-container {
  width: 115px;
  height: 100%;
  position: relative;
  flex-shrink: 0;
  background: #EFEFEF;
}

.product-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-badge-overlay {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--primary-red);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  text-transform: uppercase;
}

.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  overflow: hidden;
}

.product-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}

.product-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary-red);
}

.product-add-btn {
  background: var(--accent-gold);
  color: #000;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 3px 8px rgba(255, 179, 0, 0.4);
}

/* ==========================================================================
   5. CART SIDEBAR & MOBILE DRAWER
   ========================================================================== */
.cart-sidebar {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: 85vh;
  height: 85dvh;
  background: white;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  z-index: 999;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cart-sidebar.open-mobile {
  transform: translateY(0);
}

.cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FAFAFA;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
}

.cart-header h2 {
  font-size: 1.15rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-cart-mobile-btn {
  background: #E2E8F0;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cart-item-count-badge {
  background: var(--primary-red);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.cart-items-scroll {
  flex: 1;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  gap: 8px;
  padding: 20px;
}

.cart-item-card {
  background: #F9FAFB;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.cart-item-title { font-size: 0.95rem; font-weight: 800; color: var(--text-dark); }
.cart-item-options-text { font-size: 0.75rem; color: var(--text-muted); }

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-item-price { font-weight: 900; font-size: 1rem; color: var(--primary-red); }

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2px 6px;
}

.qty-btn {
  background: none; border: none; font-size: 1.1rem; font-weight: 800; width: 26px; height: 26px; cursor: pointer;
}

.qty-num { font-weight: 800; font-size: 0.9rem; min-width: 16px; text-align: center; }

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: white;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-subtotal-row { display: flex; justify-content: space-between; align-items: center; }
.subtotal-label { font-size: 1rem; font-weight: 700; color: var(--text-muted); }
.subtotal-amount { font-size: 1.5rem; font-weight: 900; color: var(--primary-red); }

.checkout-pay-btn {
  background: linear-gradient(90deg, var(--primary-red), #E53935);
  color: white;
  border: none;
  width: 100%;
  padding: 16px;
  border-radius: 40px;
  font-size: 1.2rem;
  font-weight: 900;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-touch);
}
.checkout-pay-btn:disabled { background: #CBD5E1; box-shadow: none; }

/* Floating Mobile Cart Bar */
.mobile-cart-bar {
  position: fixed;
  bottom: 14px; left: 14px; right: 14px;
  height: 60px;
  background: var(--primary-red);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-touch);
  z-index: 800;
  cursor: pointer;
}

.mobile-cart-bar.hidden { display: none !important; }

.mobile-cart-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-cart-count-badge {
  background: var(--accent-gold);
  color: #000;
  font-weight: 900;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.95rem;
}

.mobile-cart-action-btn {
  background: white;
  color: var(--primary-red);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.9rem;
  font-family: var(--font-main);
}

/* ==========================================================================
   6. MODALS (Fixed Backdrops & Scrollable Bodies)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0;
  overflow: hidden;
}
.modal-backdrop.hidden { display: none !important; }

.customizer-card, .payment-card {
  background: white;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.customizer-header {
  background: var(--bg-dark);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.customizer-header-info h2 { font-size: 1.2rem; font-weight: 900; }
.customizer-header-info p { font-size: 0.75rem; color: var(--accent-gold); }

.modal-close-btn {
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.customizer-body {
  flex: 1;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.customizer-section-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.portion-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.portion-option-card {
  background: #F8F9FA;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.portion-option-card.selected {
  border-color: var(--primary-red);
  background: #FFF5F5;
}

.portion-name { font-weight: 800; font-size: 0.95rem; }
.portion-price { font-weight: 900; color: var(--primary-red); font-size: 1rem; }

.customizer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: #FAFAFA;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.customizer-total-price { font-size: 1.4rem; font-weight: 900; color: var(--primary-red); }

.add-to-cart-confirm-btn {
  background: var(--primary-red);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

/* Payment Modal */
.payment-card { padding: 24px 20px; gap: 16px; text-align: center; }
.payment-methods-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pay-method-btn {
  background: #F8F9FA;
  border: 2px solid var(--border-light);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.pay-method-btn.selected { border-color: var(--primary-red); background: #FFF5F5; }
.pay-method-icon { font-size: 1.8rem; }
.pay-method-name { font-weight: 800; font-size: 0.95rem; }

/* Receipt Ticket Modal */
.receipt-card {
  background: #FFFDF8;
  border: 1px dashed #000;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  padding: 20px;
  font-family: 'Courier New', Courier, monospace;
  margin: auto;
}

.receipt-ticket-num {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary-red);
  font-family: var(--font-main);
}

/* KDS Viewport */
.kds-viewport {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: #0F172A;
  color: white;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 16px;
}
.kds-viewport.hidden { display: none !important; }
.kds-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-shrink: 0; }
.kds-orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  flex: 1;
}
.kds-order-card { background: #1E293B; border: 2px solid #334155; border-radius: 14px; padding: 14px; }
.kds-order-card.ready { border-color: #22C55E; }
.kds-ticket-num { font-size: 1.5rem; font-weight: 900; color: var(--accent-gold); }
.kds-status-btn { background: #334155; color: white; border: none; padding: 8px 12px; border-radius: 16px; font-weight: 800; font-size: 0.85rem; width: 100%; margin-top: 10px; }
.kds-status-btn.ready { background: #22C55E; }

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS (Tablets & Desktop/Kiosk Totem)
   ========================================================================== */

/* Tablet (min-width: 640px) */
@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .product-card {
    flex-direction: column;
    height: auto;
  }
  .product-thumb-container {
    width: 100%;
    height: 140px;
  }
  .portion-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .payment-methods-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .customizer-card, .payment-card {
    border-radius: 28px;
    max-width: 650px;
  }
}

/* Desktop & Kiosk Totem (min-width: 1024px) */
@media (min-width: 1024px) {
  .kiosk-header {
    height: 80px;
    padding: 0 28px;
  }
  .brand-logo-circle { width: 48px; height: 48px; font-size: 1.5rem; }
  .brand-text h1 { font-size: 1.3rem; }

  .kiosk-main {
    flex-direction: row;
    height: calc(100% - 80px);
  }

  /* Desktop Category Navigation Sidebar */
  .category-sidebar {
    width: 130px;
    height: 100%;
    flex-direction: column;
    padding: 16px 8px;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border-light);
    border-bottom: none;
  }

  .category-nav-item {
    width: 100%;
    aspect-ratio: 1 / 1;
    flex-direction: column;
    justify-content: center;
    padding: 8px;
    border-radius: 18px;
  }

  .category-nav-item .cat-icon { font-size: 2rem; }
  .category-nav-item .cat-label { font-size: 0.8rem; text-align: center; }

  /* Desktop Product Grid */
  .products-content {
    padding: 24px;
    padding-bottom: 24px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
  }

  .product-thumb-container {
    height: 160px;
  }

  /* Desktop Permanent Cart Sidebar */
  .cart-sidebar {
    position: relative;
    transform: none !important;
    width: 360px;
    height: 100%;
    border-radius: 0;
    border-left: 1px solid var(--border-light);
    box-shadow: none;
  }

  .close-cart-mobile-btn {
    display: none;
  }

  .mobile-cart-bar {
    display: none !important;
  }

  .kds-orders-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}
