/* ============================================================
   Catálogo — Estilo (piel elegante: crema / marrón / dorado)
   ============================================================ */

:root {
  --bg: #f6f1e9;
  --bg-card: #fffdf8;
  --ink: #241c14;
  --ink-soft: #6b5d4e;
  --gold: #b08d57;
  --gold-dark: #8a6c3d;
  --line: #e6dccb;
  --danger: #a33;
  --shadow: 0 10px 30px rgba(60, 40, 15, .10);
  --radius: 14px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', 'Segoe UI', sans-serif;
}

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

/* Los atributos hidden siempre ganan */
[hidden] { display: none !important; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 60;
}

.header-left { display: flex; align-items: center; gap: 14px; }
.header-right { display: flex; align-items: center; gap: 6px; }

.brand {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 2px;
  text-decoration: none;
  color: var(--ink);
  text-transform: uppercase;
}
.brand-sub {
  display: block;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-top: -2px;
}

.brand-logo {
  height: 42px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 17px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.icon-btn:hover { background: #f0e8da; }

.cart-icon { position: relative; cursor: pointer; padding: 7px 9px; border-radius: 10px; font-size: 19px; transition: background .2s; }
.cart-icon:hover { background: #f0e8da; }
.cart-count {
  position: absolute; top: -2px; right: -2px;
  background: var(--gold); color: #fff;
  font-size: 11px; font-weight: 600;
  min-width: 17px; height: 17px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.user-menu-wrap { position: relative; }
.user-dropdown {
  position: absolute; right: 0; top: 44px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; min-width: 190px; z-index: 70;
}
.user-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: none;
  font-family: var(--sans); font-size: 14px; color: var(--ink);
  border-radius: 8px; cursor: pointer;
}
.user-dropdown button:hover { background: #f4ecdd; }

/* ---------- Sidebar ---------- */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(30,20,10,.35);
  z-index: 80; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 290px;
  background: var(--bg-card); z-index: 90;
  transform: translateX(-100%); transition: transform .3s ease;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
}
.sidebar.open { transform: translateX(0); }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px; border-bottom: 1px solid var(--line);
}
.sidebar-title { font-family: var(--serif); font-size: 20px; letter-spacing: 2px; text-transform: uppercase; }
.sidebar-nav { padding: 12px; overflow-y: auto; flex: 1; }
.sidebar-nav button {
  display: block; width: 100%; text-align: left;
  padding: 11px 14px; margin-bottom: 4px;
  background: none; border: none; border-radius: 10px;
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  cursor: pointer; transition: background .15s;
}
.sidebar-nav button:hover { background: #f4ecdd; }
.sidebar-nav button.active { background: var(--gold); color: #fff; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--line); }
.sidebar-loader { padding: 20px; text-align: center; color: var(--ink-soft); }

/* ---------- Hero / búsqueda ---------- */
.search-hero { padding: 34px 24px 18px; text-align: center; }
.hero-title {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 300;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.search-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; max-width: 720px; margin: 0 auto; }
.search-wrap { position: relative; flex: 1; min-width: 250px; }
.search-wrap input {
  width: 100%; padding: 13px 44px 13px 18px;
  border: 1px solid var(--line); border-radius: 30px;
  font-family: var(--sans); font-size: 15px;
  background: var(--bg-card); color: var(--ink); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,141,87,.15); }
.search-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); opacity: .5; }

.btn-orden {
  padding: 13px 22px; border-radius: 30px;
  border: 1px solid var(--line); background: var(--bg-card);
  font-family: var(--sans); font-size: 14px; color: var(--ink);
  cursor: pointer; transition: all .2s;
}
.btn-orden:hover { border-color: var(--gold); color: var(--gold-dark); }

.orden-panel {
  max-width: 720px; margin: 14px auto 0; text-align: left;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; z-index: 55; position: relative;
}
.orden-panel-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; letter-spacing: 2px; color: var(--ink-soft); margin-bottom: 12px; }
.orden-opciones { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.orden-opciones label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.orden-opciones input { accent-color: var(--gold); }
.orden-divider { height: 1px; background: var(--line); margin: 14px 0; }
.orden-precios-title { font-size: 12px; letter-spacing: 2px; color: var(--ink-soft); margin-bottom: 8px; }
.orden-precios-inputs { display: flex; align-items: center; gap: 8px; }
.orden-precio-field { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.orden-precio-field .prefijo { padding: 0 0 0 10px; color: var(--ink-soft); }
.orden-precio-field input { border: none; outline: none; padding: 10px 12px; width: 100px; font-family: var(--sans); font-size: 14px; }
.orden-precio-sep { color: var(--ink-soft); }
.orden-precios-inputs .btn-ghost { margin-top: 10px; }

.filtro-activo-badge {
  display: inline-block; margin-top: 12px;
  background: #f0e3cd; color: var(--gold-dark);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
}

/* ---------- Botones ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #fdfaf4;
  border: none; border-radius: 30px;
  padding: 13px 26px; font-family: var(--sans); font-size: 14px;
  letter-spacing: 1px; cursor: pointer; transition: background .2s, transform .1s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--gold-dark); }
.btn-primary:active { transform: scale(.98); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line); border-radius: 30px;
  padding: 10px 20px; font-family: var(--sans); font-size: 13px; color: var(--ink-soft);
  cursor: pointer; transition: all .2s; margin-top: 10px;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-dark); }

/* ---------- Contenido ---------- */
.main-content { flex: 1; padding: 10px 24px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

.intro-block {
  max-width: 760px; margin: 8px auto 26px; text-align: center;
  font-size: 15px; line-height: 1.7; color: var(--ink-soft);
  white-space: pre-line;
}

.contador { text-align: center; color: var(--ink-soft); font-size: 13px; letter-spacing: 1px; margin-bottom: 20px; }

.loading-wrap { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--ink-soft); padding: 60px 0; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--gold);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Grid productos ---------- */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 22px;
}

.producto-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .22s, box-shadow .22s;
  display: flex; flex-direction: column;
}
.producto-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.producto-img-wrap { position: relative; aspect-ratio: 1/1; overflow: hidden; background: #efe7d8; }
.producto-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.producto-card:hover .producto-img-wrap img { transform: scale(1.04); }

.producto-tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.tag {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  border-radius: 20px; padding: 4px 10px; color: #fff;
}
.tag-top { background: var(--gold); }
.tag-nuevo { background: #2f6f4f; }

.producto-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.producto-ref { font-size: 11px; letter-spacing: 1.5px; color: var(--ink-soft); text-transform: uppercase; }
.producto-nombre { font-size: 15px; line-height: 1.35; }
.producto-cat { font-size: 12px; color: var(--ink-soft); }
.producto-precio { font-family: var(--serif); font-size: 21px; font-weight: 600; margin-top: 6px; }

.empty-state { text-align: center; color: var(--ink-soft); padding: 80px 0; font-size: 16px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 26px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  background: var(--bg-card);
}
.footer-brand { font-family: var(--serif); font-size: 18px; letter-spacing: 3px; color: var(--ink); text-transform: uppercase; margin-bottom: 6px; }

/* ---------- Modales ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(25,17,8,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }

.modal-content { position: relative; background: var(--bg-card); border-radius: var(--radius); max-width: 92vw; max-height: 90vh; overflow: auto; }
.modal-box { position: relative; background: var(--bg-card); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 420px; }

.modal-close { position: absolute; top: 12px; right: 12px; z-index: 5; }

.image-modal-content { display: flex; flex-wrap: wrap; max-width: 860px; }
.image-modal-img-wrap { flex: 1 1 380px; min-width: 280px; background: #efe7d8; display: flex; align-items: center; justify-content: center; }
.image-modal-img-wrap img { width: 100%; max-height: 78vh; object-fit: contain; }
.modal-info { flex: 1 1 300px; padding: 46px 26px 26px; display: flex; flex-direction: column; gap: 8px; }
.modal-tags { display: flex; gap: 6px; }
.modal-nombre { font-family: var(--serif); font-size: 24px; }
.modal-ref { font-size: 12px; letter-spacing: 1.5px; color: var(--ink-soft); text-transform: uppercase; }
.modal-precio { font-size: 24px; font-weight: 600; margin: 6px 0 12px; }

/* Qty */
.qty-box { text-align: center; }
.qty-nombre { font-family: var(--serif); font-size: 20px; margin-bottom: 18px; }
.qty-controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 20px; }
.qty-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  font-size: 20px; cursor: pointer; transition: all .2s;
}
.qty-btn:hover { border-color: var(--gold); color: var(--gold-dark); }
.qty-val { font-size: 24px; min-width: 40px; font-weight: 500; }

/* Carrito */
.cart-box { max-width: 460px; }
.cart-header { display: flex; justify-content: space-between; align-items: center; font-family: var(--serif); font-size: 22px; letter-spacing: 1px; margin-bottom: 14px; }
.cart-items { max-height: 46vh; overflow-y: auto; margin-bottom: 12px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cart-item-img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #efe7d8; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-ref { font-size: 11px; color: var(--ink-soft); letter-spacing: 1px; }
.cart-item-qty { display: flex; align-items: center; gap: 8px; }
.cart-item-qty button { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; }
.cart-item-price { font-weight: 600; white-space: nowrap; }
.cart-total { font-family: var(--serif); font-size: 22px; text-align: right; margin-bottom: 14px; }
.cart-box .btn-primary, .cart-box .btn-ghost { width: 100%; }

/* Contacto */
.contact-phones { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.contact-phone {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  text-decoration: none; color: var(--ink); transition: border-color .2s;
}
.contact-phone:hover { border-color: var(--gold); }
.contact-phone .cp-desc { font-size: 13px; color: var(--ink-soft); }
.contact-phone .cp-num { font-weight: 600; }
.wa-btn { width: 100%; }

/* Login */
.login-box { text-align: center; }
.login-hint { color: var(--ink-soft); font-size: 13px; margin: 4px 0 16px; }
.input {
  width: 100%; padding: 12px 16px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--sans); font-size: 15px; outline: none; background: #fff;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,141,87,.15); }
.login-box .btn-primary { width: 100%; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header { padding: 10px 14px; }
  .brand { font-size: 20px; }
  .main-content { padding: 10px 14px 50px; }
  .productos-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
  .producto-precio { font-size: 17px; }
  .image-modal-content { flex-direction: column; }
}
