:root {
  --naranja: #FF9D20;
  --naranja-oscuro: #e57f00;
  --gris-claro: #f5f5f5;
  --texto: #222222;
  --borde: #eeeeee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--texto);
  background: #ffffff;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* NAV */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  z-index: 1000;
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-left { display: flex; align-items: center; gap: 1rem; flex: 1; }

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: var(--naranja);
  white-space: nowrap;
}

.nav-logo-icon {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.nav-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 1.2rem;
  flex-wrap: wrap;
}

.nav-links a { position: relative; padding-bottom: 0.2rem; }
.nav-link-search {
  display: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--naranja);
  transition: width 0.2s ease;
}
.nav-links a:hover::after { width: 100%; }

@media (min-width: 1025px) {
  .nav {
    flex-wrap: nowrap;
  }
  .nav-left {
    min-width: 0;
    flex-wrap: nowrap;
  }
  .nav-logo {
    font-size: 1.25rem;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  .nav-links {
    gap: 1rem;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
}

@media (min-width: 721px) and (max-width: 1024px) {
  .nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "left right"
      "search search";
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.9rem;
    max-width: 100%;
  }
  .nav-left {
    grid-area: left;
    min-width: 0;
    gap: 0.7rem;
    flex-wrap: wrap;
  }
  .nav-logo {
    font-size: 1.02rem;
    letter-spacing: 0.02em;
  }
  .nav-logo-icon {
    width: 34px;
    height: 34px;
  }
  .nav-links {
    gap: 0.55rem;
    font-size: 0.95rem;
    flex-wrap: wrap;
  }
  .nav-right {
    grid-area: right;
    gap: 0.4rem;
    flex-shrink: 0;
  }
  .nav-right .btn {
    padding: 0.42rem 0.62rem;
    font-size: 0.78rem;
  }
  .nav-search {
    grid-area: search;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  body {
    padding-top: 162px;
  }
}

.nav-right { display: flex; align-items: center; gap: 0.5rem; }

.btn {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-cart {
  background: var(--naranja);
  color: #fff;
  box-shadow: 0 4px 10px rgba(255,157,32,0.38);
}
.btn-cart:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(255,157,32,0.55); }

.btn-whatsapp-nav {
  background: #25D366;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,211,102,0.35);
}
.btn-whatsapp-nav:hover { background: #1ebe5d; transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--naranja), #ffc26a);
  color: #fff;
  box-shadow: 0 4px 10px rgba(255,157,32,0.45);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(255,157,32,0.6); }

.btn-outline {
  border: 1px solid var(--naranja);
  color: var(--naranja);
  background: transparent;
}
.btn-outline:hover { background: var(--naranja); color: #fff; }

.badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--naranja);
  color: #fff;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* SEARCH (NAV) */
.nav-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 250px;
  max-width: 250px;
  min-width: 170px;
  position: relative;
  z-index: 1200;
}

.nav-search input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #dddddd;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.nav-search input:focus {
  border-color: var(--naranja);
  box-shadow: 0 0 0 2px rgba(255,157,32,0.2);
}

.nav-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.12);
  overflow: hidden;
  display: none;
  z-index: 1100;
}

.nav-suggestions.show { display: block; }

.nav-suggestions button {
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.85rem;
  background: transparent;
  border: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.nav-suggestions button:hover { background: #fff8ee; }

.sugg-title { font-weight: 650; font-size: 0.92rem; }
.sugg-meta { font-size: 0.78rem; color: #666; margin-top: 0.12rem; }
.sugg-price { font-weight: 800; color: var(--naranja-oscuro); font-size: 0.88rem; }
.sugg-empty { padding: 0.8rem 0.85rem; color: #777; font-size: 0.9rem; }

/* HERO */
.hero {
  margin-top: 70px;
  min-height: 72vh;
  display: grid;
  place-items: center;
  padding: 3rem 1.25rem 3.5rem;
  background-image:
    linear-gradient(120deg, rgba(255, 157, 32, 0.7), rgba(255, 255, 255, 0.9)),
    url("https://images.pexels.com/photos/3662735/pexels-photo-3662735.jpeg?auto=compress&cs=tinysrgb&w=1600");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
  color: #1b1308;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.9), transparent 55%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 2.5rem;
}

.hero h1 { font-size: clamp(2.1rem, 4vw, 3rem); margin-bottom: 0.75rem; }
.hero h1 span { color: #c26e00; }
.hero p { font-size: 1rem; max-width: 34rem; margin-bottom: 1.25rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.hero-photo-card {
  background: rgba(255,255,255,0.86);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  backdrop-filter: blur(8px);
}
.hero-photo-card img { border-radius: 14px; height: 280px; object-fit: cover; width: 100%; }
.hero-photo-card h2 { margin-top: 0.75rem; font-size: 1.05rem; color: #b85a00; }
.hero-photo-card small { display: block; margin-top: 0.25rem; color: #555; }

/* SECTIONS */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}
.section-title { font-size: 1.6rem; margin-bottom: 0.5rem; }
.section-subtitle { font-size: 0.95rem; color: #666; margin-bottom: 1.25rem; }

.catalog-top-nav {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-bottom: 1rem;
  max-width: 100%;
}

.catalog-tabs {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  max-width: 100%;
}

.catalog-tab {
  border: 1px solid rgba(255,157,32,0.4);
  background: #fff8ee;
  color: #8a5a16;
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.catalog-tab:hover {
  border-color: var(--naranja);
  color: var(--naranja-oscuro);
}

.catalog-tab.active {
  background: var(--naranja);
  color: #fff;
  border-color: var(--naranja);
  box-shadow: 0 4px 10px rgba(255,157,32,0.3);
}

.catalog-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.catalog-tab-nav {
  flex: 0 0 auto;
  min-width: 2.5rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

/* MINI CATALOG */
.mini-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.pill-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid rgba(255,157,32,0.35);
  background: #fff8ee;
  color: #8a5a16;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}
.pill.active {
  background: var(--naranja);
  border-color: var(--naranja);
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.card {
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
}

.card-img { position: relative; overflow: hidden; }
.card-img img { width: 100%; height: auto; max-height: 200px; object-fit: contain; transition: transform 0.3s ease; border-radius: 16px !important; }
.card:hover .card-img img { transform: scale(1.05); }
.tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(0,0,0,0.75);
  color: #fff;
}
.card-body { padding: 0.85rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.card-title { font-size: 1rem; font-weight: 600; }
.card-desc { font-size: 0.85rem; color: #666; flex: 1; }
.meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.15rem; }
.price { font-weight: 700; color: var(--naranja-oscuro); }
.age { font-size: 0.75rem; color: #666; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.35rem; }
.stock { font-size: 0.78rem; color: #4a7a06; }
.btn-small { padding: 0.45rem 0.85rem; font-size: 0.82rem; }

/* CART */
.cart-layout {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.cart-list {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--borde);
  padding: 1rem;
  max-height: 360px;
  overflow-y: auto;
}
.cart-empty { color: #777; text-align: center; padding: 1.2rem 0.5rem; }
.cart-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1.7fr) auto auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px dashed var(--borde);
}
.cart-item:last-child { border-bottom: none; }
.cart-thumb-wrap {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--borde);
  background: #fff;
}
.cart-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cart-title { font-weight: 500; }
.cart-qty { display: inline-flex; align-items: center; gap: 0.35rem; justify-content: end; }
.qty-btn {
  border-radius: 999px;
  width: 24px;
  height: 24px;
  border: 1px solid #ddd;
  background: #fafafa;
  cursor: pointer;
  font-size: 0.85rem;
}
.cart-price { font-weight: 600; text-align: right; }
.summary {
  background: #fff8ee;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255,157,32,0.35);
}
.sum-row { display: flex; justify-content: space-between; font-size: 0.95rem; margin-bottom: 0.35rem; }
.sum-row.total { font-weight: 800; font-size: 1.05rem; margin-top: 0.5rem; }
.note { font-size: 0.8rem; color: #8a5a16; margin-top: 0.6rem; }
.actions { margin-top: 0.85rem; display: flex; flex-direction: column; gap: 0.55rem; }

/* MODAL */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.show { display: flex; }

.modal-content {
  background: #ffffff;
  border-radius: 18px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}

.modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--borde);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 { margin: 0; font-size: 1.2rem; }

#closeModal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  border-radius: 16px !important;
}

#modalDesc { font-size: 0.95rem; color: #666; }
#modalPrice { font-weight: 700; color: var(--naranja-oscuro); font-size: 1.1rem; }
#modalAge { font-size: 0.9rem; color: #666; }

/* MEDIA QUERIES PARA MÓVIL */
@media (max-width: 768px) {
  body { padding-top: 140px; }
  .hero { margin-top: 0; }
  main.section { padding-top: 2rem !important; }
  .nav { padding: 0.5rem 1rem; }
}
.btn-whatsapp { background: #25D366; color: #fff; justify-content: center; width: 100%; box-shadow: 0 4px 12px rgba(37,211,102,0.4); }
.btn-whatsapp:hover { background: #1ebe5d; }
.btn-muted { background: #fff; border: 1px solid #ddd; justify-content: center; width: 100%; }

/* FOOTER */
footer {
  border-top: 1px solid var(--borde);
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
  font-size: 0.82rem;
  color: #777;
}
footer span { color: var(--naranja-oscuro); font-weight: 700; }

/* RESPONSIVE */
#miniCatalog {
  display: flex !important;
  overflow-x: auto;
  gap: 1.25rem;
  padding-bottom: 0.5rem;
}
#miniCatalog .card {
  min-width: 220px;
  flex: 0 0 auto;
}

/* ocultar etiquetas de productos */
.card .tag {
  display: none !important;
}

@media (max-width: 900px) {
  .hero-content { grid-template-columns: 1fr; }
  .nav { flex-wrap: wrap; }
  .nav-search { order: 3; max-width: none; width: 100%; }
  .cart-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .hero { background-attachment: scroll; }

  header { transition: box-shadow 0.2s ease, background-color 0.2s ease; }
  .nav {
    max-width: 100%;
    padding: 0.45rem 0.7rem;
    gap: 0.45rem;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
  }
  .nav-left {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    align-items: center;
  }
  .nav-logo {
    gap: 0.45rem;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
  }
  .nav-logo-icon {
    width: 34px;
    height: 34px;
  }
  .nav-logo span {
    max-width: 100px;
    overflow: hidden;
    white-space: nowrap;
    text-indent: -6.6em;
    font-size: 0.95rem;
  }
  .nav-links {
    display: flex;
    gap: 0.75rem;
    font-size: 0.95rem;
    white-space: nowrap;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
  }
  .nav-link-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding-bottom: 0.2rem;
  }
  .nav-right {
    width: 100%;
    justify-content: space-between;
    gap: 0.45rem;
  }
  .nav-right .btn {
    flex: 1;
    justify-content: center;
    padding: 0.42rem 0.65rem;
    font-size: 0.78rem;
  }
  .nav-search {
    display: none;
  }
  body.mobile-search-open .nav-search {
    display: flex;
  }
  body {
    padding-top: 126px;
  }
  main.section {
    overflow-x: hidden;
  }

  body.nav-compact .nav {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
  body.nav-compact .nav-logo span {
    display: none;
  }
  body.nav-compact .nav-left {
    grid-template-columns: auto 1fr;
  }
  body.nav-compact .nav-logo-icon {
    width: 30px;
    height: 30px;
  }
  body.nav-compact {
    padding-top: 94px;
  }

  /* CART RESPONSIVE MOBILE FIX */
  .cart-item {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "thumb title title"
      "thumb desc desc"
      "thumb price qty";
    gap: 0.3rem 0.5rem;
    padding: 0.75rem 0.25rem;
  }
  .cart-thumb-wrap { grid-area: thumb; width: 48px; height: 48px; border-radius: 9px; }
  .cart-title { grid-area: title; font-weight: 600; }
  .cart-desc { grid-area: desc; font-size: 0.8rem; margin-bottom: 0.2rem; }
  .cart-price { grid-area: price; text-align: left; }
  .cart-qty { grid-area: qty; justify-content: flex-end; }
  .cart-list {
    max-height: none;
    overflow: visible;
  }
  .summary {
    padding: 0.9rem;
  }
  .actions .btn {
    width: 100%;
    justify-content: center;
  }

  .catalog-tabs,
  .catalog-top-nav {
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
    gap: 0.4rem;
    width: 100%;
    max-width: 100%;
  }
  .catalog-top-nav {
    justify-content: flex-end;
  }
  .catalog-tab {
    flex: 0 0 auto;
    min-width: 2.25rem;
    white-space: nowrap;
    text-align: center;
    padding: 0.42rem 0.55rem;
  }
}

/* FEEDBACK VISUAL PARA AGREGAR AL CARRITO */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-added {
  background-color: #4CAF50 !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4) !important;
  transition: all 0.3s ease !important;
}

.btn-added:hover {
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5) !important;
}

/* ULTRA MOBILE - Pantallas muy delgadas */
@media (max-width: 380px) {
  body {
    padding-top: 110px;
  }
  body.nav-compact {
    padding-top: 80px;
  }
  .nav {
    padding: 0.35rem 0.5rem;
    gap: 0.3rem;
  }
  .nav-logo {
    gap: 0.3rem;
    font-size: 0.95rem;
  }
  .nav-logo-icon {
    width: 30px;
    height: 30px;
  }
  .nav-logo span {
    max-width: 100px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.75rem;
    text-indent: -6.8em;
  }
  .nav-left {
    gap: 0.3rem;
  }
  .nav-links {
    display: flex;
    gap: 0.25rem;
    font-size: 0.7rem;
    width: auto;
    grid-template-columns: unset;
    font-size: 0.9rem;
  }
  .nav-links a {
    white-space: nowrap;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
  }
  .nav-link-search {
    display: inline-flex;
    font-size: 0.8rem;
    padding: 0.25rem 0.3rem;
  }
  .nav-right .btn {
    padding: 0.38rem 0.5rem;
    font-size: 0.7rem;
  }
  .badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.3rem;
  }
}
