﻿/* ========================================================
   MiraLaCarta — App Styles (app.css)
   Estilos especficos de la app cliente (landing y men)
   ======================================================== */

/* ===== SPLASH ===== */
.splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(160deg, #1a0000, var(--primary) 40%, var(--accent));
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
}
.splash-screen.fade-out { animation: fadeOut 0.5s forwards; }
.splash-icon { font-size: 64px; animation: popIn 0.6s cubic-bezier(0.34,1.56,0.64,1); }
.splash-brand { font-size: 24px; font-weight: 800; color: #fff; }
.splash-loader { width: 120px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.splash-loader-bar { width: 40%; height: 100%; background: #fff; border-radius: 2px; animation: loading 1.2s infinite ease-in-out; }
@keyframes loading { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.splash-text { font-size: 13px; opacity: 0.7; color: #fff; }

/* ===== LANDING (sin localId) ===== */
.landing-screen {
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 80vh; gap: 12px; color: #fff;
  text-align: center;
}
.landing-icon { font-size: 72px; animation: popIn 0.6s cubic-bezier(0.34,1.56,0.64,1); }
.landing-brand { font-size: 32px; font-weight: 800; }
.landing-desc { max-width: 320px; font-size: 14px; opacity: 0.85; line-height: 1.6; }
.landing-desc code { background: rgba(255,255,255,0.15); padding: 2px 8px; border-radius: 6px; }

/* ===== ERROR ===== */
.error-screen {
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 80vh; gap: 12px; color: #fff; text-align: center;
}
.err-icon { font-size: 56px; }
.err-title { font-size: 22px; font-weight: 700; }
.err-desc { font-size: 14px; opacity: 0.8; max-width: 300px; line-height: 1.5; }

/* ===== APP CONTENT (con localId) ===== */
#app-content { display: none; width: 100%; }

.hero {
  display: flex; flex-direction: column;
  align-items: center; padding: 48px 0 32px;
  text-align: center;
}
.logo, .header-logo-img {
  width: 130px; height: 130px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.4);
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  margin-bottom: 16px;
  animation: popIn 0.6s cubic-bezier(0.34,1.56,0.64,1);
  background: #fff;
}
.hero h1 {
  font-size: 28px; font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  margin-bottom: 6px; color: #fff;
}
.tagline {
  font-size: 14px; opacity: 0.9;
  max-width: 260px; line-height: 1.5; color: #fff;
}
.links {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column;
  gap: 14px; margin-top: 10px; margin-left: auto; margin-right: auto;
}
.link-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 20px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50px; color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 15px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.link-btn:hover {
  background: rgba(255,255,255,0.28);
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.link-btn.primary {
  background: #fff; color: var(--primary);
  border-color: transparent;
}
.link-btn.primary:hover { background: #fff; color: var(--primary-dark); }

#install-banner {
  display: none; background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px; padding: 14px 16px;
  max-width: 380px; width: 100%; margin: 20px auto 0;
  font-size: 13px; color: #fff;
  align-items: center; gap: 12px; justify-content: space-between;
}
#install-banner.show { display: flex; }
#install-btn {
  background: #fff; color: var(--primary);
  border: none; border-radius: 20px;
  padding: 8px 16px; font-weight: 700;
  font-family: 'Outfit', sans-serif;
  cursor: pointer; white-space: nowrap;
}

/* ===== MENU HEADER ===== */
.menu-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--accent));
  padding: 20px 16px 28px;
  text-align: center;
  position: relative;
}
.menu-header-logo {
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.4);
  object-fit: cover;
  margin-bottom: 10px; background-color: #fff; padding: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  display: inline-block;
}
.menu-header h1 { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: 0.5px; margin-bottom: 4px; }
.menu-header p { font-size: 12px; color: rgba(255,255,255,0.85); }
.store-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.store-status.open { background: rgba(0,200,83,0.2); color: #00c853; }
.store-status.closed { background: rgba(229,57,53,0.2); color: #ff5252; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; animation: pulse 2s infinite; }
.store-status.open .status-dot { background: #00c853; }
.store-status.closed .status-dot { background: #ff5252; }

.back-btn {
  position: absolute; left: 12px; top: 14px;
  background: rgba(255,255,255,0.2); border: none; border-radius: 50%;
  width: 38px; height: 38px; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 20px;
  transition: background 0.2s;
}
.back-btn:hover { background: rgba(255,255,255,0.35); }

/* MESA BADGE */
.mesa-badge {
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 18px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

/* SOLO VISUALIZACION BANNER */
.view-only-banner {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-left: 4px solid var(--accent);
  margin: 12px;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text2);
}

/* BUSQUEDA */
.search-wrap { padding: 12px 12px 0; }
.search-box {
  width: 100%; padding: 12px 16px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 30px; color: var(--text);
  font-size: 14px; outline: none; transition: border 0.2s;
}
.search-box:focus { border-color: var(--primary); }

/* FILTRO CATEGORIAS */
.cat-tabs {
  display: flex; gap: 8px;
  padding: 12px; overflow-x: auto;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: 8px 18px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 30px; color: var(--text2);
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.cat-tab.active, .cat-tab:hover {
  background: var(--primary); border-color: var(--primary);
  color: #fff;
}

/* CATEGORIAS Y PRODUCTOS */
.menu-section { padding: 0 12px; }
.cat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 0 12px;
}
.cat-header h2 { font-size: 18px; font-weight: 800; color: var(--text); }
.cat-divider { flex: 1; height: 1px; background: var(--border); }
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(229,57,53,0.2);
}
.product-card.selected {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(0,200,83,0.3);
}
.product-img {
  width: 100%; height: 120px; object-fit: cover;
  background: var(--bg3); border-bottom: 1px solid var(--border);
}
.card-body { padding: 12px 12px 10px; flex: 1; display: flex; flex-direction: column; }
.card-name { font-size: 13px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.card-price { font-size: 16px; font-weight: 800; color: var(--accent); margin-top: auto; }
.card-options { font-size: 11px; color: var(--text2); margin-top: 4px; }
.card-desc { font-size: 10px; color: var(--text2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-qty-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--primary); color: #fff;
  border-radius: 50%; width: 22px; height: 22px;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.card-add-btn {
  display: block; width: 100%;
  padding: 8px; border: none; border-top: 1px solid var(--border);
  background: var(--bg3); color: var(--text);
  font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.card-add-btn:hover { background: var(--primary); color: #fff; }
.product-card.selected .card-add-btn { background: var(--primary); color: #fff; }

/* BARRA INFERIOR PEDIDO */
.order-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 12px 16px 16px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.order-bar.visible { transform: translateY(0); }
.order-bar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.order-total { font-size: 18px; font-weight: 800; color: var(--accent); }
.clear-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text2); border-radius: 20px;
  padding: 6px 12px; font-size: 11px;
  cursor: pointer; transition: all 0.2s;
}
.clear-btn:hover { border-color: var(--primary); color: var(--primary); }

/* MODALES */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-sheet {
  background: var(--bg2);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 32px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s ease;
  position: relative;
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border); border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.modal-subtitle { font-size: 12px; color: var(--text2); margin-bottom: 16px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg3); border: none; border-radius: 50%;
  width: 32px; height: 32px; color: var(--text);
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.qty-controls { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 16px 0; }
.qty-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg3); color: var(--text);
  font-size: 22px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-num { font-size: 36px; font-weight: 800; min-width: 50px; text-align: center; }

/* CHECKOUT ITEMS */
.checkout-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.checkout-item-qty { color: var(--primary); font-weight: 700; margin-right: 6px; }
.checkout-item-name { flex: 1; }
.checkout-item-price { font-weight: 700; color: var(--accent); }
.checkout-subtotal-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; color: var(--text2); font-size: 12px;
}

/* Opciones seleccionables (Delivery/Pago) */
.checkout-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer;
  transition: all 0.2s;
}
.checkout-option:hover { border-color: var(--primary); }
.checkout-option.selected {
  background: rgba(229,57,53,0.1); border-color: var(--primary);
}
.checkout-radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.checkout-option.selected .checkout-radio { border-color: var(--primary); }
.checkout-option.selected .checkout-radio::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary);
}

.product-detail-img {
  width: calc(100% + 40px); margin: -20px -20px 0;
  height: 200px; object-fit: cover; border-bottom: 1px solid var(--border);
}
.product-detail-qty {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg3); padding: 4px; border-radius: 30px;
  border: 1px solid var(--border);
}

/* LOADER */
.loader-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 16px;
}
.no-results { text-align: center; padding: 40px 20px; color: var(--text2); font-size: 14px; }
