/* =============================================
   Design Tokens
   ============================================= */
:root {
  --primary:       #1A9D55;
  --primary-dark:  #0F6E3A;
  --primary-deep:  #0A4A27;
  --surface:       #FFFFFF;
  --bg:            #F3F8F5;
  --text:          #111D17;
  --text-muted:    #6B7C72;
  --border:        #E0EBE5;
  --success:       #F97316;   /* naranja — diferenciado del verde principal */
  --success-dark:  #EA6000;
  --danger:        #EF4444;
  --danger-dark:   #DC2626;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.11);
  --header-height: 52px;
  --search-height: 56px;
  --nav-height:    54px;
}

/* =============================================
   Reset & Base
   ============================================= */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Arial', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

/* =============================================
   Page Header  (shared — quiniela, confirm, post-payment)
   ============================================= */
.page-header {
  background: var(--primary);
  color: white;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--header-height);
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-avatar {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.5);
  font-family: 'Manrope', sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  justify-self: start;
}

.header-sep {
  display: none; /* not used in grid layout */
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #22C55E;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
  justify-self: end;
}

.header-address {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  overflow: hidden;
  justify-self: center;
}

.header-address svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.8;
}

.header-address span {
  font-family: 'Manrope', sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* =============================================
   Search Bar  (menu page)
   ============================================= */
#search-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 150;
  background: var(--bg);
  padding: 10px 14px;
  height: var(--search-height);
  display: flex;
  align-items: center;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 0 16px;
  gap: 10px;
  height: 44px;
  width: 100%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.search-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06), 0 0 0 3px rgba(26, 157, 85, 0.12);
}

.search-icon {
  width: 17px;
  height: 17px;
  color: #C0C0C0;
  flex-shrink: 0;
  transition: color 0.15s;
}

.search-input-wrap:focus-within .search-icon {
  color: var(--primary);
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;   /* ≥16px evita el zoom automático en iOS Safari */
  font-family: 'Inter', sans-serif;
  background: none;
  color: var(--text);
  min-width: 0;
  font-weight: 400;
}

#search-input::placeholder {
  color: #C4C4C4;
  font-weight: 400;
}

.search-clear {
  width: 22px;
  height: 22px;
  background: #D0D0D0;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  transition: background 0.15s;
}

.search-clear.visible {
  display: flex;
}

.search-clear:hover {
  background: #A0A0A0;
}

/* No-results state */
#search-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}

#search-empty.visible {
  display: flex;
}

.search-empty-icon {
  font-size: 3rem;
  margin-bottom: 14px;
  opacity: 0.3;
}

#search-empty p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #AEAEAE;
}

#search-empty strong {
  color: var(--text);
}

/* =============================================
   Category Navigation  (menu page)
   ============================================= */
#category-nav {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  padding: 12px 14px;
  gap: 7px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: calc(var(--header-height) + var(--search-height));
  z-index: 100;
  scrollbar-width: none;
}
#category-nav::-webkit-scrollbar { display: none; }

#category-nav button {
  flex: 0 0 auto;
  padding: 0 16px;
  height: 34px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  background: transparent;
  color: #AEAEAE;
  border: 1.5px solid #E4E4E4;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

#category-nav button.active {
  background: var(--primary-deep);
  color: #fff;
  border-color: var(--primary-deep);
  letter-spacing: 0.8px;
}

#category-nav button:hover:not(.active) {
  color: var(--text);
  border-color: #C0C0C0;
}

/* =============================================
   Product Catalog  (menu page)
   ============================================= */
#menu {
  padding: 10px 14px 110px;
}

.category-section {
  margin-top: 24px;
  scroll-margin-top: calc(var(--header-height) + var(--search-height) + var(--nav-height) + 8px);
}

.category-title {
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin: 0 0 14px;
  padding: 0 2px;
  display: inline-block;

  /* Estado base — verde oscuro estático */
  background: linear-gradient(
    100deg,
    #0A4A27 0%,
    #0A4A27 44%,
    #2DB86A 50%,
    #0A4A27 56%,
    #0A4A27 100%
  );
  background-size: 200% auto;
  background-position: 200% center;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 4px rgba(26, 157, 85, 0.15));
  transition: filter 0.4s ease;
}

/* El brillo solo ocurre cuando entra en pantalla */
.category-title.in-view {
  animation: emerald-shine 2.2s ease-out forwards;
  filter: drop-shadow(0 0 4px rgba(26, 157, 85, 0.18));
}

@keyframes emerald-shine {
  0%   { background-position: 200% center; }
  100% { background-position: 0% center; }
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06), 0 4px 14px rgba(0,0,0,0.04);
  border: 1px solid rgba(26, 157, 85, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.menu-item img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--bg);
}

.menu-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-name {
  font-family: 'Manrope', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.2px;
}

.item-price {
  font-family: 'Manrope', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  letter-spacing: -0.3px;
}

.menu-ingredients {
  font-size: 0.75rem;
  color: #C0C0C0;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 400;
}

/* =============================================
   Quantity Stepper
   ============================================= */
.quantity-control {
  display: flex;
  align-items: center;
}

.quantity-control button {
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: opacity 0.15s;
  padding: 0;
  background: var(--primary);
  color: white;
}

.quantity-control button.decrease {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.quantity-control button.decrease:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.quantity-control button:hover:not(:disabled) {
  opacity: 0.82;
}

.quantity-display {
  width: 36px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* =============================================
   Cart Bar  (fixed bottom — menu page only)
   ============================================= */
#cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0A4A27;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 18px;
  z-index: 300;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.22);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}

#cart-bar.visible {
  transform: translateY(0);
}

/* Clickable left area — opens the cart sheet */
.cart-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px 0;
  flex: 1;
  text-align: left;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}

.cart-bar-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.7;
}

.cart-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.cart-count {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.cart-total {
  font-family: 'Manrope', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.cart-view-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 6px 11px 6px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  flex-shrink: 0;
}

.cart-view-pill svg {
  width: 11px;
  height: 11px;
}

.cart-bar-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(26, 157, 85, 0.45);
  letter-spacing: -0.2px;
  -webkit-tap-highlight-color: transparent;
}

.cart-bar-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

/* =============================================
   Cart Sheet  (bottom sheet — menu page)
   ============================================= */
.cart-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cart-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  z-index: 401;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
}

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

.cart-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}

.cart-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cart-sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.cart-sheet-close {
  width: 32px;
  height: 32px;
  background: var(--text);
  border: none;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.cart-sheet-close:hover  { background: var(--text-muted); }
.cart-sheet-close:active { transform: scale(0.9); }

.cart-sheet-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
  -webkit-overflow-scrolling: touch;
}

.cart-sheet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.cart-sheet-item:last-child {
  border-bottom: none;
}

.cart-sheet-item-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
}

.cart-sheet-item-qty {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  flex-shrink: 0;
}

.cart-sheet-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 56px;
  text-align: right;
}

.cart-sheet-footer {
  border-top: 2px solid var(--border);
  padding: 14px 16px 20px;
  flex-shrink: 0;
}

.cart-sheet-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 14px;
}

.cart-sheet-total-amount {
  font-size: 1.25rem;
  color: var(--primary);
}

.cart-sheet-confirm {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  box-shadow: 0 3px 12px rgba(26, 157, 85, 0.35);
  letter-spacing: -0.2px;
}

.cart-sheet-confirm:active {
  opacity: 0.9;
  transform: scale(0.98);
}

/* =============================================
   Order Summary  (confirmation & post-payment pages)
   ============================================= */
.page-content {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.page-content.pb-action-bar {
  padding-bottom: 88px;
}

.order-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}

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

.order-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.order-id {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.order-item {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.order-item:last-of-type {
  border-bottom: none;
}

.remove-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, transform 0.1s;
}
.remove-btn:hover  { background: var(--danger-dark); transform: scale(1.08); }
.remove-btn:active { transform: scale(0.92); }

.order-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.order-item-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.order-item-qty {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  background: var(--primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

.order-item-price {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text);
}

.order-total {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg);
  border-top: 2px solid var(--border);
  font-weight: 700;
  font-size: 1.05rem;
}

.info-row {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.info-row strong {
  color: var(--text);
}

/* =============================================
   Action Bar  (fixed bottom — confirmation page)
   ============================================= */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  z-index: 300;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.btn {
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover  { opacity: 0.85; }
.btn:active { opacity: 0.7;  }

.btn-back {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  flex: 0 0 auto;
  min-width: 88px;
}

.btn-confirm {
  background: var(--success);
  color: white;
  flex: 1;
}

/* =============================================
   Success Banner  (post-payment page)
   ============================================= */
.success-banner {
  background: var(--success);
  color: white;
  text-align: center;
  padding: 22px 16px;
}

.success-banner h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.success-banner p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.88rem;
}

/* =============================================
   Error Page
   ============================================= */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.error-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.error-card h1 {
  color: var(--danger);
  font-size: 1.25rem;
  margin: 0 0 12px;
}

.error-card p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}
