/* =============================================
   TIENDA ONLINE - Dalibery
   Página de compra para clientes
============================================= */

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

:root {
  --bg: #0a0a12;
  --surface: #12121e;
  --surface-alt: #181828;
  --border: #1e1e32;
  --text: #e8e8f0;
  --text-muted: #6b6b8a;
  --accent: #ff6b35;
  --accent-hover: #ff8555;
  --accent-glow: rgba(255,107,53,0.25);
  --green: #22c55e;
  --green-glow: rgba(34,197,94,0.2);
  --radius: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 40px;
}

/* HEADER */
.store-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 1.4rem;
}

.logo span {
  font-weight: 900;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.cart-btn {
  position: relative;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.cart-btn:hover {
  border-color: var(--accent);
  background: rgba(255,107,53,0.08);
}

.cart-count {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  position: absolute;
  top: -6px;
  right: -6px;
}

/* HERO */
.store-hero {
  text-align: center;
  padding: 40px 24px 24px;
}

.store-hero h1 {
  font-size: 2rem;
  font-weight: 800;
}

.store-hero p {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 0.95rem;
}

/* CATEGORIES */
.categories {
  display: flex;
  gap: 10px;
  padding: 0 24px 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: center;
  flex-wrap: wrap;
}

.categories::-webkit-scrollbar { display: none; }

.cat-btn {
  padding: 8px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.cat-btn:hover { border-color: var(--accent); color: var(--text); }
.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* MENU GRID */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 24px;
  max-width: 1200px;
  margin: 0 auto;
}

/* PRODUCT CARD */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.product-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.product-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-cat {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

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

.product-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--green);
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), #f7931e);
  border: none;
  border-radius: 12px;
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.add-btn:hover { box-shadow: 0 4px 15px var(--accent-glow); transform: scale(1.03); }
.add-btn:active { transform: scale(0.97); }

.add-btn.added {
  background: var(--green);
  box-shadow: 0 4px 15px var(--green-glow);
}

/* QTY CONTROLS (shown when item is in cart) */
.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover { border-color: var(--accent); background: rgba(255,107,53,0.1); }
.qty-btn.minus:hover { border-color: #ef4444; background: rgba(239,68,68,0.1); }

.qty-value {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* CART SIDEBAR */
.cart-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.cart-overlay.open { opacity: 1; visibility: visible; }

.cart-sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.open { right: 0; }

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

.cart-header h2 { font-size: 1.2rem; font-weight: 700; }

.cart-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* CART ITEMS */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

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

.cart-empty span { font-size: 3rem; }
.cart-empty p { font-weight: 600; }

.cart-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  animation: fadeIn 0.3s ease-out;
}

.cart-item-icon {
  width: 46px;
  height: 46px;
  background: var(--surface-alt);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.cart-item-price {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item-qty button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-subtotal {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--green);
  display: flex;
  align-items: center;
}

/* CART FOOTER */
.cart-footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  background: var(--surface-alt);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.cart-total span:first-child { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.total-value { font-size: 1.5rem; font-weight: 900; color: var(--green); }

/* CHECKOUT */
.checkout-form h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; }

.checkout-form input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  transition: border-color 0.3s;
}

.checkout-form input:focus { outline: none; border-color: var(--accent); }
.checkout-form input::placeholder { color: var(--text-muted); }

.payment-options {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.payment-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.payment-option input { display: none; }
.payment-icon { font-size: 1.5rem; }

.payment-option.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(255,107,53,0.06);
}

.btn-checkout {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #f7931e);
  border: none;
  border-radius: 14px;
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-checkout:hover { box-shadow: 0 6px 30px var(--accent-glow); }
.btn-checkout:disabled { opacity: 0.5; cursor: not-allowed; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green);
  color: white;
  padding: 12px 24px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 500;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 20px rgba(34,197,94,0.3);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* SUCCESS MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 400;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-success {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 50px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: popIn 0.4s ease-out;
}

.success-icon { font-size: 4rem; margin-bottom: 16px; }
.modal-success h2 { font-size: 1.6rem; margin-bottom: 12px; }
.modal-success p { color: var(--text-muted); font-size: 0.95rem; }
.success-sub { margin-top: 4px; font-size: 0.85rem !important; }

.btn-back {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--accent), #f7931e);
  border-radius: 12px;
  color: white;
  text-decoration: none;
  font-weight: 700;
  transition: all 0.3s;
}

/* LOADING */
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* RESPONSIVE */
@media (max-width: 768px) {
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 0 14px; }
  .product-img { height: 130px; font-size: 3rem; }
  .product-body { padding: 12px; }
  .product-name { font-size: 0.95rem; }
  .product-price { font-size: 1.05rem; }
  .add-btn { padding: 8px 12px; font-size: 0.8rem; }
  .store-hero h1 { font-size: 1.5rem; }
  .cart-sidebar { width: 100%; max-width: 100vw; }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
