:root {
  --brand: #b0261c;
  --brand-dark: #8f1c14;
  --brand-soft: #fbeae7;
  --accent: #e6a500;
  --dark: #2b2320;
  --muted: #6c757d;
  --cream: #faf6f1;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--dark);
}

a { color: var(--brand); }

.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splash-logo {
  animation: splashFade 0.5s ease-in-out;
}
@keyframes splashFade {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---------- Header ---------- */
.store-header {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  border-bottom: 3px solid var(--brand);
}
.topbar {
  background: var(--dark);
  color: #f0e9e4;
  padding: 4px 0;
}
.topbar i { color: var(--accent); }

.logo-badge {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.logo-text { font-weight: 800; color: var(--brand); font-size: 1.05rem; line-height: 1.1; }
.logo-sub  { font-size: .68rem; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.logo-img  { height: 135px; width: auto; max-width: 400px; object-fit: contain; flex-shrink: 0; }

.search-form { position: relative; }
.search-form .form-control {
  border-radius: 24px;
  padding-right: 44px;
  border: 2px solid #ddd;
}
.search-form .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(176,38,28,.12); }
.search-form button {
  position: absolute; right: 4px; top: 4px;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.search-form button:hover { background: var(--brand-dark); }

.user-chip, .cart-chip {
  color: var(--dark);
  font-weight: 600;
  font-size: .9rem;
  align-items: center;
  gap: 6px;
}
.user-chip:hover, .cart-chip:hover { color: var(--brand); }
.user-chip i, .cart-chip i { font-size: 1.4rem; }

.cart-badge {
  position: absolute; top: -6px; right: -10px;
  background: var(--brand); color: #fff;
  font-size: .68rem; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.navbar-toggler-nav {
  background: none; border: none;
  font-size: 1.6rem; color: var(--dark);
}

.main-nav {
  background: #fff;
  border-top: 1px solid #eee;
  padding: 6px 0;
}
.main-nav .nav-link {
  color: var(--dark);
  font-size: .88rem;
  font-weight: 600;
  padding: .35rem .5rem;
  white-space: nowrap;
}
.main-nav .nav-link:hover { color: var(--brand); }
.btn-cat-dropdown { display: inline-flex; align-items: center; gap: 6px; color: #fff; }
.dropdown-menu-cats { min-width: 230px; }

/* ---------- Carrusel / hero ---------- */
.hero { border-radius: 16px; overflow: hidden; position: relative; }
.hero img { height: 256px; object-fit: cover; width: 100%; background: #fff; }
.hero .hero-caption {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.55), transparent 70%);
  display: flex; align-items: center;
}
.hero .hero-caption .inner { padding: 2rem; color: #fff; max-width: 480px; }
.hero h2 { font-weight: 800; }
.hero .lead { opacity: .95; }

/* ---------- Secciones ---------- */
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; margin-bottom: 1rem;
}
.section-title .bar { width: 5px; height: 24px; background: var(--brand); border-radius: 3px; }

/* ---------- Categorías ---------- */
.cat-card {
  background: #fff; border-radius: 14px;
  padding: 1rem; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  transition: transform .15s ease, box-shadow .15s ease;
  color: var(--dark); text-decoration: none;
  height: 100%;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.1); color: var(--dark); }
.cat-card .pic {
  width: 90px; height: 90px; margin: 0 auto .6rem;
  border-radius: 12px; overflow: hidden; flex-shrink: 0;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.cat-card .pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cat-card .name { font-weight: 700; font-size: .9rem; }
.cat-card .count { font-size: .75rem; color: var(--muted); }

/* ---------- Producto ---------- */
.product-card {
  background: #fff; border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
  text-decoration: none; color: var(--dark);
  position: relative;
  height: 100%;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.12); color: var(--dark); }
.product-card .thumb {
  height: 170px; overflow: hidden;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
@media (max-width: 767.98px) {
  .product-card .thumb { height: 140px; }
}
.product-card .body { padding: .85rem; display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.product-card .cat { font-size: .7rem; text-transform: uppercase; color: var(--muted); letter-spacing: .5px; }
.product-card .name { font-weight: 700; font-size: .95rem; }
.product-card .presentation { font-size: .78rem; color: var(--muted); }
.product-card .price { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.product-card .now { font-size: 1.25rem; font-weight: 800; color: var(--brand); }
.product-card .was { text-decoration: line-through; color: var(--muted); font-size: .85rem; }
.product-card .tag {
  position: absolute; top: 10px; left: 10px;
  z-index: 2;
  font-size: .68rem; font-weight: 700;
  padding: 4px 8px; border-radius: 6px;
  color: #fff;
}
.tag-offer { background: var(--brand); }
.tag-new { background: #198754; }
.tag-best { background: var(--accent); color: #333; }
.tag-agotado { background: #dc3545; }
.tag-agotado-grande {
  background: linear-gradient(135deg, #b02a37, #dc3545);
  color: #fff; font-size: .8rem; font-weight: 800;
  padding: 6px 12px; border-radius: 8px;
  box-shadow: 0 3px 10px rgba(220,53,69,.4);
  animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,53,69,.4); }
  50% { box-shadow: 0 0 0 8px rgba(220,53,69,0); }
}

/* Ficha de producto: overlay gris sobre la galería cuando está agotado */
.product-gallery.gallery-agotado {
  position: relative;
  filter: grayscale(0.4) brightness(0.92);
}
.gallery-sold-badge {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  background: #dc3545; color: #fff; width: 34px; height: 34px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(220,53,69,.5); font-size: 1.2rem;
}

.product-card.out-of-stock { opacity: .72; }
.product-card.out-of-stock:hover { transform: none; }
.product-card.out-of-stock .add-to-cart-btn { display: none; }
.add-to-cart-btn:disabled { background: var(--muted); box-shadow: none; cursor: default; }
.add-to-cart-btn {
  position: absolute; bottom: 12px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(176,38,28,.35);
}
.add-to-cart-btn:hover { background: var(--brand-dark); color: #fff; }

/* ---------- Detalle de producto ---------- */
.product-gallery img { border-radius: 14px; width: 100%; background: #fff; }
.thumb-gallery img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.thumb-gallery img.active { border-color: var(--brand); }
.qty-control {
  display: inline-flex; align-items: center;
  border: 2px solid #ddd; border-radius: 24px; overflow: hidden;
}
.qty-control button {
  width: 40px; height: 40px; border: none; background: #f1ece6;
  font-weight: 700; font-size: 1.1rem;
}
.qty-control .qty-input {
  width: 60px; text-align: center; border: none;
  font-weight: 700; outline: none;
}

/* ---------- Variantes ---------- */
.variant-pill input { display: none; }
.variant-pill .pill {
  display: inline-block; padding: .5rem 1rem; border-radius: 12px;
  border: 2px solid #ddd; background: #fff; cursor: pointer;
  font-size: .82rem; font-weight: 600; text-align: center; min-width: 90px;
}
.variant-pill input:checked + .pill { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.variant-pill .pill small { font-weight: 400; color: var(--muted); }

.info-panel {
  background: #fff; border-radius: 14px; padding: 1.4rem;
  text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.05); height: 100%;
}
.info-panel i { font-size: 2rem; color: var(--brand); }
.info-panel h6 { font-weight: 800; margin-top: .5rem; }

/* ---------- Botones ---------- */
.btn-brand {
  background: var(--brand); color: #fff; font-weight: 700;
  border-radius: 24px; padding: .6rem 1.4rem;
}
.btn-brand:hover { background: var(--brand-dark); color: #fff; }
.btn-outline-brand {
  border: 2px solid var(--brand); color: var(--brand); font-weight: 700;
  border-radius: 24px; padding: .55rem 1.3rem;
}
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

/* ---------- Carrito ---------- */
.cart-list .item-row { background: #fff; border-radius: 12px; padding: .8rem; margin-bottom: .6rem; }
.cart-list .thumb { width: 70px; height: 70px; border-radius: 10px; object-fit: cover; }
.summary-box { background: #fff; border-radius: 14px; padding: 1.2rem; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.summary-line { display: flex; justify-content: space-between; margin-bottom: .4rem; font-size: .92rem; }
.summary-line.total { border-top: 1px dashed #ddd; padding-top: .6rem; font-weight: 800; font-size: 1.1rem; }

/* ---------- Footer / misc ---------- */
.store-footer { background: var(--dark); color: #e9e2dc; margin-top: 3rem; }
.store-footer h6 { color: #fff; font-weight: 700; }
.footer-links { list-style: none; padding: 0; }
.footer-links a { color: #cfc6be; text-decoration: none; font-size: .88rem; }
.footer-links a:hover { color: #fff; }
.footer-bottom { background: rgba(0,0,0,.25); }
.social-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.social-btn:hover { background: var(--brand); color: #fff; }
.payment-badge {
  background: rgba(255,255,255,.12);
  font-size: .72rem; padding: 3px 8px; border-radius: 4px;
  color: #fff;
}

.wa-float {
  position: fixed; bottom: 22px; right: 22px; z-index: 1050;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff; font-size: 1.7rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(37,211,102,.45);
}
.wa-float:hover { background: #1ebe57; color: #fff; }

/* ---------- Auth / formularios ---------- */
.auth-panel {
  background: #fff; border-radius: 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,.07);
  padding: 2rem;
  max-width: 460px; margin: 2rem auto;
}

/* Rutas de pedido */
.status-stepper { display: flex; list-style: none; padding: 0; gap: 0; margin: 1.2rem 0; }
.status-stepper li {
  flex: 1; text-align: center; position: relative;
  font-size: .72rem; color: var(--muted);
}
.status-stepper li .dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: #e7e1da; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px; font-size: .8rem;
}
.status-stepper li .line {
  position: absolute; top: 15px; left: 50%; width: 100%;
  height: 2px; background: #e7e1da; z-index: 0;
}
.status-stepper li:first-child .line { display: none; }
.status-stepper li.done .dot { background: #198754; color: #fff; }
.status-stepper li.done .line { background: #198754; }
.status-stepper li.active .dot { background: var(--brand); color: #fff; }
.status-stepper li .dot { position: relative; z-index: 1; }

/* Admin */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--dark); color: #fff;
  padding: 1rem 0;
  flex-shrink: 0;
}
.admin-sidebar a { color: #cfc6be; text-decoration: none; display: block; padding: .6rem 1.2rem; font-size: .92rem; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,.08); color: #fff; }
.admin-main { flex-grow: 1; padding: 1.5rem; background: #f4f1ec; }
.table-card { background: #fff; border-radius: 12px; padding: 1rem; box-shadow: 0 2px 6px rgba(0,0,0,.05); }

.alert-danger { --bs-alert-bg: #fbeaea; --bs-alert-border-color: #f3c6c0; color: #842029; }

/* ---------- Admin ---------- */
.stat-card {
  background: #fff; border-radius: 12px; padding: 1rem 1.2rem;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.05); height: 100%;
}
.stat-card i { font-size: 1.8rem; color: var(--brand); }
.stat-card.warning i { color: var(--accent); }
.stat-card.success i { color: #198754; }
.stat-card .val { font-weight: 800; font-size: 1.2rem; display: block; line-height: 1.1; }
.stat-card .lbl { font-size: .75rem; color: var(--muted); }

.delivery-opt {
  border: 2px solid #e5e0da; border-radius: 12px; padding: 1rem;
  cursor: pointer; height: 100%;
}
.delivery-opt input:checked + label { color: var(--brand); font-weight: 700; }
.delivery-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.order-action {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .25rem; margin-left: .25rem;
  color: var(--muted); background: none; border: 0;
  text-decoration: none; cursor: pointer;
  transition: color .15s ease-in-out;
}
.order-action:hover { color: var(--dark); }
.order-action-danger:hover { color: #dc3545; }

@media (max-width: 767.98px) {
  .search-form .form-control { font-size: .9rem; }
  .product-card .thumb { height: 150px; }
  .hero img { height: 176px; }
  .adm-table-wrap { overflow-x: auto; }
}