/* === HÖSEG CAFÉ - Sistema de Pedidos PWA === */

:root {
  --primary: #A82A3D;
  --primary-dark: #840B30;
  --primary-light: #DDBDBF;
  --cream: #EFEEEA;
  --dark: #40393D;
  --dark-text: #211C24;
  --gray: #8F8F8F;
  --white: #FFFFFF;
  --success: #2E7D32;
  --warning: #F57F17;
  --accent: #527572;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--dark-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lang-select {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.lang-select option { color: var(--dark-text); background: white; }
.track-link {
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.9;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  transition: all 0.2s;
}
.track-link:hover { opacity: 1; background: rgba(255,255,255,0.2); }
.app-header .tagline {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 4px;
}
.slogan-header {
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Categories Tabs */
.category-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 12px 16px;
  background: var(--cream);
  position: sticky;
  top: 110px;
  z-index: 99;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--primary-light);
  background: transparent;
  color: var(--dark-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.category-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.category-tab:hover { border-color: var(--primary); }

/* Products Grid */
.menu-section {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
}
.category-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: none;
}
.category-title.visible { display: block; }

.products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.product-card {
  background: white;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: all 0.2s;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
}
.product-card:active { transform: scale(0.97); }
.product-card.featured {
  border-color: var(--primary-light);
  background: linear-gradient(135deg, #fff 60%, #FFF5F5);
}
.product-card .featured-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent);
  color: white;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
}
.product-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.product-card .desc {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .price {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.product-card .price::before { content: 'S/ '; }
.product-card .add-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  float: right;
  transition: all 0.2s;
}
.product-card .add-btn:hover { background: var(--primary-dark); }
.product-card .add-btn:active { transform: scale(0.9); }
.product-card .product-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--cream);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--gray);
}
.empty-state .icon { font-size: 48px; margin-bottom: 8px; }

/* Cart Floating Button */
.cart-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(168,42,61,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.cart-fab:hover { transform: scale(1.05); }
.cart-fab .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--warning);
  color: white;
  font-size: 12px;
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cart Drawer */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: none;
  backdrop-filter: blur(2px);
}
.cart-overlay.open { display: block; }

.cart-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 301;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 24px 20px 100px;
}
.cart-drawer.open { transform: translateY(0); }
.cart-drawer .handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: -12px auto 16px;
}
.cart-drawer h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}
.cart-item .item-info { flex: 1; }
.cart-item .item-name { font-weight: 600; font-size: 15px; }
.cart-item .item-price { font-size: 14px; color: var(--primary); font-weight: 700; }
.cart-item .qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-item .qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--primary-light);
  background: transparent;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
.cart-item .qty-btn:hover { background: var(--primary-light); }
.cart-item .qty { font-weight: 700; font-size: 16px; min-width: 24px; text-align: center; }
.cart-item .item-subtotal { font-size: 14px; font-weight: 700; color: var(--dark); min-width: 60px; text-align: right; }

.cart-total {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 20px;
  font-weight: 800;
}

/* Checkout Form */
.checkout-form { margin-top: 16px; }
.checkout-form h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.form-group { margin-bottom: 10px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s;
  background: var(--cream);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 60px; }

.order-type-group {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.order-type-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid #e0e0e0;
  background: white;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 14px;
}
.order-type-btn.active {
  border-color: var(--primary);
  background: #FFF0F0;
  color: var(--primary);
}
.order-type-btn .type-icon { font-size: 24px; display: block; margin-bottom: 4px; }

.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.submit-btn:hover { background: var(--primary-dark); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.submit-btn .loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

/* Confirmation */
.confirmation {
  text-align: center;
  padding: 32px 16px;
  display: none;
}
.confirmation .check-icon {
  width: 80px;
  height: 80px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 40px;
  color: white;
}
.confirmation h2 { font-size: 24px; margin-bottom: 8px; }
.confirmation .order-code {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
  margin: 12px 0;
}
.confirmation .status-track {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 24px 0;
  flex-wrap: wrap;
}
.confirmation .status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gray);
}
.confirmation .status-step.active { color: var(--primary); font-weight: 700; }
.confirmation .status-step.done { color: var(--success); }
.confirmation .slogan-confirm {
  background: linear-gradient(135deg, #FFF5F5, #FFEFE0);
  border: 2px solid var(--primary-light);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== TRACKING - TIMELINE ========== */
.track-page {
  padding: 24px 16px;
  max-width: 500px;
  margin: 0 auto;
}
.track-box {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  text-align: center;
}
.track-box h2 { font-size: 22px; margin-bottom: 4px; }
.track-desc { color: var(--gray); font-size: 14px; margin-bottom: 16px; }
.track-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.track-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  text-align: center;
  font-weight: 700;
  letter-spacing: 1px;
}
.track-input:focus { outline: none; border-color: var(--primary); }
.track-btn {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.track-result { margin-top: 16px; text-align: left; }
.back-btn {
  margin-top: 16px;
  padding: 8px 16px;
  background: transparent;
  border: 2px solid var(--primary-light);
  border-radius: 8px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

/* Timeline vertical */
.timeline {
  position: relative;
  padding-left: 40px;
  margin: 20px 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: #e0e0e0;
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  padding: 0 0 32px 16px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -40px;
  top: 2px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e8e8e8;
  border: 3px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 1;
  transition: all 0.4s;
}
.timeline-dot.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
  box-shadow: 0 2px 8px rgba(46,125,50,0.3);
}
.timeline-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 6px rgba(168,42,61,0.15);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 6px rgba(168,42,61,0.15); }
  50% { box-shadow: 0 0 0 12px rgba(168,42,61,0.08); }
}
.timeline-label {
  font-size: 16px;
  font-weight: 600;
  color: #ccc;
  transition: all 0.3s;
}
.timeline-label.done { color: var(--success); }
.timeline-label.active { color: var(--primary); font-weight: 700; }
.timeline-desc {
  font-size: 12px;
  color: var(--gray);
  margin-top: 2px;
  display: none;
}
.timeline-desc.active { display: block; }

/* Tiempo estimado */
.track-estimate {
  background: var(--cream);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  margin-top: 12px;
}
.track-estimate .est-text { font-size: 13px; color: var(--gray); }

/* Maps Button */
.maps-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px;
  padding: 12px;
  background: white;
  border: 2px solid var(--primary-light);
  border-radius: 12px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.maps-btn:hover {
  background: var(--cream);
  border-color: var(--primary);
}
.maps-btn span:first-child { font-size: 20px; }

/* Marketing Opt-in */
.marketing-opt { margin-top: 4px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--dark-text);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

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

@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .app-header { padding: 10px 12px; }
  .track-input-group { flex-direction: column; }
  .category-tabs { top: 130px; }
}
