/* ===== Y&Y Plastic — colores del branding ===== */
:root {
  --turquesa: #0DC9B2;
  --verde: #44A57F;
  --verde-osc: #2f7d5f;
  --carbon: #333333;
  --crema: #F3F0E8;
  --blanco: #ffffff;
  --gris: #6b6b6b;
  --linea: #e2ddd1;
  --rojo: #d64545;

  --bg: var(--crema);
  --surface: var(--blanco);
  --text: var(--carbon);
  --muted: var(--gris);

  --radius: 14px;
  --shadow: 0 2px 10px rgba(51, 51, 51, .06), 0 10px 30px rgba(51, 51, 51, .06);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--verde-osc); }

.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }

/* ===== Botones ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .75em 1.4em;
  border: 2px solid var(--verde);
  border-radius: 999px;
  background: var(--verde);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .1s;
}
.btn:hover { background: var(--verde-osc); border-color: var(--verde-osc); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--small { padding: .45em 1em; font-size: .85rem; }
.btn--ghost { background: transparent; color: var(--verde-osc); }
.btn--ghost:hover { background: rgba(68, 165, 127, .1); color: var(--verde-osc); }
.btn--light { background: #fff; color: var(--carbon); border-color: #fff; }
.btn--light:hover { background: var(--crema); border-color: var(--crema); }
.btn--dark { background: var(--carbon); border-color: var(--carbon); }
.btn--danger { background: var(--rojo); border-color: var(--rojo); }
.btn--danger.btn--ghost { background: transparent; color: var(--rojo); }
.btn--danger.btn--ghost:hover { background: rgba(214, 69, 69, .08); }
.btn--wa { background: #25D366; border-color: #25D366; width: 100%; }
.btn--wa:hover { background: #1da851; border-color: #1da851; }

/* ===== Encabezado ===== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(243, 240, 232, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--linea);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 10px; }
.brand__logo { height: 54px; width: auto; }

.price-toggle {
  display: inline-flex; padding: 4px;
  background: #fff; border: 1px solid var(--linea); border-radius: 999px;
}
.price-toggle button {
  border: 0; background: transparent; cursor: pointer;
  padding: .5em 1.1em; border-radius: 999px;
  font-weight: 600; font-size: .9rem; color: var(--muted);
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.price-toggle button.is-active { background: var(--verde); color: #fff; }
body[data-modo="mayor"] .price-toggle button.is-active { background: var(--turquesa); }

/* ===== Carrusel ===== */
.hero { position: relative; overflow: hidden; background: var(--carbon); }
.hero__track { display: flex; transition: transform .6s cubic-bezier(.4, 0, .2, 1); }
.hero__slide { position: relative; flex: 0 0 100%; aspect-ratio: 12 / 5; max-height: 560px; min-height: 260px; overflow: hidden; }
.hero__slide > img { width: 100%; height: 100%; object-fit: cover; }
.hero__slide.is-hidden-slide { opacity: .45; }
.hero__caption {
  position: absolute; inset: auto 0 0 0;
  padding: 48px max(16px, calc((100% - 1200px) / 2)) 40px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  color: #fff;
}
.hero__caption h2 { margin: 0 0 .2em; font-size: clamp(1.4rem, 3.5vw, 2.6rem); font-weight: 800; }
.hero__caption p { margin: 0 0 1em; max-width: 60ch; font-size: clamp(.95rem, 1.6vw, 1.15rem); }

.hero__slide--brand {
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(13, 201, 178, .18), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(68, 165, 127, .22), transparent 45%),
    var(--crema);
}
.hero__brand { text-align: center; padding: 24px; }
.hero__brand img { width: min(360px, 70vw); margin: 0 auto 12px; }
.hero__brand p { margin: 0 0 18px; font-size: clamp(1rem, 2vw, 1.3rem); color: var(--verde-osc); letter-spacing: .04em; }

.hero__nav {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .85); color: var(--carbon);
  font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow);
}
.hero__nav--prev { left: 16px; }
.hero__nav--next { right: 16px; }
.hero__dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.hero__dots button { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .6); cursor: pointer; transition: width .3s, background .3s; }
.hero__dots button.is-active { width: 28px; background: var(--turquesa); }
.hero.is-single .hero__nav, .hero.is-single .hero__dots { display: none; }
.hero__edit { position: absolute; top: 14px; right: 14px; }

/* ===== Catálogo ===== */
.catalog { padding-block: 40px 64px; }
.catalog__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.catalog__title { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.01em; }
.catalog__title::after { content: ''; display: block; width: 56px; height: 4px; margin-top: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--turquesa), var(--verde)); }
.catalog__note { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }

.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; fill: var(--muted); }
.search input {
  width: 100%; padding: .8em 1em .8em 2.6em;
  border: 1px solid var(--linea); border-radius: 999px; background: #fff;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.search input:focus { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(68, 165, 127, .18); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; scrollbar-width: thin; }
.chip {
  flex: 0 0 auto; padding: .5em 1.1em;
  border: 1px solid var(--linea); border-radius: 999px; background: #fff;
  font-weight: 500; font-size: .9rem; cursor: pointer; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--verde); }
.chip.is-active { background: var(--carbon); border-color: var(--carbon); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  border: 0; padding: 0; text-align: left;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: 0 4px 14px rgba(51,51,51,.08), 0 16px 40px rgba(51,51,51,.1); outline: none; }
.card.is-inactive { opacity: .55; }
.card__img { position: relative; aspect-ratio: 1; background: #faf8f3; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__img .card__placeholder { object-fit: contain; padding: 28%; opacity: .25; }
.card__body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 16px; flex: 1; }
.card__cat { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--verde); }
.card__name { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.card__unit { font-size: .8rem; color: var(--muted); }
.card__admin { display: none; gap: 6px; padding: 0 14px 14px; }

.badge { position: absolute; top: 10px; left: 10px; padding: .25em .7em; border-radius: 999px; background: var(--turquesa); color: #fff; font-size: .7rem; font-weight: 700; letter-spacing: .03em; }
.badge--dark { left: auto; right: 10px; background: var(--carbon); }

.price { display: flex; flex-direction: column; margin-top: auto; padding-top: 8px; }
.price__main { font-size: 1.2rem; font-weight: 800; color: var(--carbon); }
.price__main--muted { color: var(--muted); font-size: 1rem; }
.price__sub { font-size: .75rem; color: var(--verde-osc); font-weight: 600; }
.price__alt { font-size: .8rem; color: var(--muted); }
body[data-modo="mayor"] .card .price__main:not(.price__main--muted) { color: var(--verde-osc); }

.card--new {
  align-items: center; justify-content: center; gap: 6px; min-height: 300px;
  border: 2px dashed var(--verde); background: rgba(68, 165, 127, .06); box-shadow: none;
  color: var(--verde-osc); font-weight: 700;
}
.card--new span { font-size: 2.6rem; line-height: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.more { display: flex; justify-content: center; margin-top: 28px; }

/* ===== Pie ===== */
.footer { background: #fff; border-top: 1px solid var(--linea); }
.footer__inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 32px; padding-block: 40px; }
.footer__logo { width: 180px; }
.footer__slogan { color: var(--verde-osc); letter-spacing: .04em; margin: 12px 0 0; }
.footer__desc { margin-top: 0; color: var(--muted); }
.footer__info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.footer__info dt { font-weight: 600; font-size: .85rem; }
.footer__info dd { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.footer__bottom { background: var(--verde); color: #fff; font-size: .8rem; }
.footer__bottom-inner { display: flex; justify-content: space-between; align-items: center; padding-block: 10px; gap: 12px; }
.footer__credit { padding: 10px 16px; background: #fff; text-align: center; font-size: .75rem; color: var(--muted); letter-spacing: .02em; }
.footer__credit strong { color: #6D28D9; font-weight: 700; }
.footer__admin {
  width: 30px; height: 30px; padding: 6px; border: 0; border-radius: 50%;
  background: transparent; color: rgba(255, 255, 255, .45); cursor: pointer;
  transition: color .2s, background .2s;
}
.footer__admin:hover { color: #fff; background: rgba(255, 255, 255, .15); }
.footer__admin svg { width: 100%; height: 100%; display: block; }

.socials { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.social {
  display: inline-flex; align-items: center; gap: 10px;
  padding: .7em 1.3em .7em .9em; border-radius: 999px;
  color: #fff; font-weight: 600; text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  transition: transform .15s, box-shadow .15s;
}
.social:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.social svg { width: 24px; height: 24px; }
.social--whatsapp { background: #25D366; }
.social--instagram { background: linear-gradient(45deg, #f9ce34, #ee2a7b 45%, #6228d7); }
.footer__data { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.footer__data li { display: flex; align-items: center; gap: 8px; }
.footer__data svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--verde); }

.wa-float {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: #25D366; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.wa-float svg { width: 30px; }
.wa-float[hidden] { display: none; }

/* ===== Modal ===== */
.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, 100% - 24px); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal--wide { width: min(940px, 100% - 24px); }
.modal::backdrop { background: rgba(30, 30, 30, .55); backdrop-filter: blur(3px); }
.modal__box { position: relative; padding: 28px; }
.modal__close { position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--crema); font-size: 24px; line-height: 1; cursor: pointer; z-index: 2; }

/* Ficha de producto */
.product { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; }
.product__main { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: #faf8f3; }
.product__main img { width: 100%; height: 100%; object-fit: contain; }
.product__thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.product__thumbs button { flex: 0 0 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: none; }
.product__thumbs button.is-active { border-color: var(--verde); }
.product__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product__info h2 { margin: 4px 0 6px; font-size: 1.5rem; line-height: 1.25; }
.product__code, .product__unit { margin: 0; color: var(--muted); font-size: .9rem; }
.product__prices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.pbox { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--linea); border-radius: 12px; }
.pbox span { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pbox strong { font-size: 1.35rem; }
.pbox small { color: var(--verde-osc); font-weight: 600; }
.pbox.is-active { border-color: var(--verde); background: rgba(68, 165, 127, .07); }
.product__desc { color: #4a4a4a; margin: 0 0 18px; }
#pvEditar { margin-top: 10px; }

/* Formularios admin */
.form { display: flex; flex-direction: column; gap: 14px; }
.form h2 { margin: 0 0 4px; }
.form label, .form__field { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; }
.form small { font-weight: 400; color: var(--muted); }
.form input:not([type="checkbox"]):not([type="file"]), .form select, .form textarea, .list input, .slide-row input:not([type="checkbox"]) {
  width: 100%; padding: .65em .8em; border: 1px solid var(--linea); border-radius: 10px; background: #fff; font-weight: 400;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid rgba(68, 165, 127, .35); border-color: var(--verde); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form__row--3 { grid-template-columns: repeat(3, 1fr); }
.form__checks { align-items: end; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--verde); }
.form__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.form__hint { margin: 0; color: var(--muted); font-size: .85rem; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #faf8f3; border: 1px solid var(--linea); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo__main { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 6px; background: var(--verde); color: #fff; font-size: .65rem; }
.photo__btn { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); cursor: pointer; font-size: 14px; line-height: 1; }
.photo__btn--del { left: auto; right: 4px; color: var(--rojo); font-size: 18px; }
.photo--add { display: flex !important; align-items: center; justify-content: center; flex-direction: column; gap: 0 !important; border: 2px dashed var(--verde); color: var(--verde-osc); cursor: pointer; background: rgba(68, 165, 127, .05); }
.photo--add span { font-size: 1.8rem; line-height: 1; }
.is-loading { pointer-events: none; opacity: .6; position: relative; }
.is-loading::after { content: 'Comprimiendo y subiendo…'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.85); font-size: .75rem; text-align: center; color: var(--verde-osc); }

.list { display: flex; flex-direction: column; gap: 8px; }
.list__row { display: grid; grid-template-columns: 1fr 76px auto auto; gap: 8px; align-items: center; }
.list__row--new { grid-template-columns: 1fr 76px auto; padding-top: 12px; border-top: 1px solid var(--linea); }

.slides { display: flex; flex-direction: column; gap: 12px; }
.slide-row { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 10px; border: 1px solid var(--linea); border-radius: 12px; }
.slide-row img { width: 100%; aspect-ratio: 12 / 5; object-fit: cover; border-radius: 8px; }
.slide-row__fields { display: flex; flex-direction: column; gap: 6px; }
.slide-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .85rem; }
.slide-row__meta label { display: flex; align-items: center; gap: 6px; flex-direction: row; font-weight: 500; }
.slide-row__meta input[name="orden"] { width: 70px; }
.upload-btn { align-self: flex-start; }

/* ===== Admin ===== */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: revert !important; }
body.is-admin .card__admin { display: flex !important; }
body.is-admin .adminbar { display: flex !important; }
body.is-admin { padding-bottom: 74px; }
body.is-admin .wa-float { bottom: 88px; }

.adminbar {
  position: fixed; left: 50%; bottom: 14px; translate: -50% 0; z-index: 45;
  flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px;
  width: max-content; max-width: calc(100% - 24px);
  padding: 8px 10px; border-radius: 18px;
  background: var(--carbon); box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.adminbar__tag { color: var(--turquesa); font-weight: 700; font-size: .8rem; padding: 0 6px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; top: 18px; translate: -50% -150%; z-index: 100;
  padding: .7em 1.2em; border-radius: 12px; background: var(--carbon); color: #fff;
  font-weight: 500; box-shadow: var(--shadow); transition: translate .3s, opacity .3s;
  max-width: calc(100% - 32px);
  opacity: 0; pointer-events: none;
}
.toast.is-visible { translate: -50% 0; opacity: 1; }
.toast--error { background: var(--rojo); }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .brand__logo { height: 40px; }
  .price-toggle button { padding: .45em .8em; font-size: .8rem; }
  .hero__slide { aspect-ratio: 4 / 3; }
  .hero__nav { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card__body { padding: 10px 10px 12px; }
  .card__name { font-size: .9rem; }
  .price__main { font-size: 1.05rem; }
  .card__admin { flex-wrap: wrap; padding: 0 10px 10px; }
  .product { grid-template-columns: 1fr; gap: 16px; }
  .modal__box { padding: 20px 16px; }
  .form__row, .form__row--3 { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr; }
  .slide-row { grid-template-columns: 1fr; }
  .list__row { grid-template-columns: 1fr 64px; }
  .list__row .btn { width: 100%; }
}
@media (max-width: 420px) {
  .topbar__inner { flex-direction: column; align-items: stretch; gap: 8px; }
  .brand { align-self: center; }
  .price-toggle { justify-content: stretch; }
  .price-toggle button { flex: 1; }
}

@media (max-width: 760px) {
  .footer__bottom-inner { padding-right: 64px; }
}
