/* ============================================================
   DENDA IBÉRICA — Tienda Online — CSS Principal
   ============================================================ */

:root {
  --rojo:     #c0392b;
  --rojo-osc: #962d22;
  --rojo-cl:  #fdf2f2;
  --dorado:   #d4a017;
  --verde:    #27ae60;
  --gris:     #6b7280;
  --gris-cl:  #f9fafb;
  --borde:    #e5e7eb;
  --texto:    #1f2937;
  --blanco:   #ffffff;
  --sombra:   0 2px 12px rgba(0,0,0,.10);
  --sombra-h: 0 6px 24px rgba(0,0,0,.16);
  --radio:    12px;
  --radio-sm: 8px;
  --trans:    .18s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--texto);
  background: #fafaf9;
  line-height: 1.6;
}

a { color: var(--rojo); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ---- HEADER ---- */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--rojo);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 1rem;
}
.logo {
  display: flex; align-items: center; gap: .45rem;
  color: var(--blanco); font-weight: 700; font-size: 1.15rem;
  text-decoration: none;
}
.logo-icon { font-size: 1.4rem; }
.header-nav {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.nav-link {
  color: rgba(255,255,255,.88); font-size: .9rem;
  text-decoration: none; padding: .25rem .5rem; border-radius: var(--radio-sm);
  transition: background var(--trans);
}
.nav-link:hover { background: rgba(255,255,255,.15); text-decoration: none; }

/* ---- BOTONES ---- */
.btn-primary {
  background: var(--rojo); color: var(--blanco);
  border: none; border-radius: var(--radio-sm); padding: .5rem 1.1rem;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background var(--trans), transform var(--trans);
  text-decoration: none; display: inline-block;
}
.btn-primary:hover { background: var(--rojo-osc); transform: translateY(-1px); text-decoration: none; color: #fff; }

.btn-secondary {
  background: rgba(255,255,255,.15); color: var(--blanco);
  border: 1.5px solid rgba(255,255,255,.5); border-radius: var(--radio-sm);
  padding: .5rem 1.1rem; font-size: .9rem; font-weight: 500; cursor: pointer;
  transition: background var(--trans);
}
.btn-secondary:hover { background: rgba(255,255,255,.25); }

.btn-block { width: 100%; text-align: center; }
.btn-grande { padding: .75rem 1.5rem; font-size: 1rem; }

.btn-carrito {
  background: rgba(255,255,255,.15); color: var(--blanco);
  border: 1.5px solid rgba(255,255,255,.4); border-radius: var(--radio-sm);
  padding: .4rem .8rem; font-size: .95rem; cursor: pointer;
  transition: background var(--trans);
}
.btn-carrito:hover { background: rgba(255,255,255,.25); }

/* ---- USER MENU ---- */
.user-menu { position: relative; }
.btn-user {
  background: rgba(255,255,255,.15); color: var(--blanco);
  border: 1.5px solid rgba(255,255,255,.4); border-radius: var(--radio-sm);
  padding: .4rem .9rem; cursor: pointer; font-size: .9rem;
}
.user-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--blanco); border-radius: var(--radio-sm); min-width: 160px;
  box-shadow: var(--sombra-h); overflow: hidden; z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: block; padding: .7rem 1rem; color: var(--texto);
  font-size: .9rem; transition: background var(--trans);
}
.user-dropdown a:hover { background: var(--gris-cl); text-decoration: none; }

/* ---- HERO OFERTAS ---- */
.hero-ofertas {
  position: relative; overflow: hidden;
  background: #1a0a0a; max-height: 440px;
}
.ofertas-slider { position: relative; }
.oferta-slide {
  display: none; position: relative; min-height: 300px;
  align-items: center; justify-content: center;
}
.oferta-slide.active { display: flex; }
.oferta-slide img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: .55;
}
.oferta-contenido {
  position: relative; z-index: 1; text-align: center;
  color: var(--blanco); padding: 2.5rem 2rem;
  max-width: 600px;
}
.oferta-contenido h2 { font-size: 2rem; font-weight: 700; margin-bottom: .5rem; }
.oferta-contenido p { font-size: 1.1rem; margin-bottom: 1.25rem; opacity: .9; }

.slider-dots {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  display: flex; gap: .5rem; z-index: 2;
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,.4); cursor: pointer; transition: background var(--trans);
}
.dot.active { background: var(--blanco); }

/* HERO DEFAULT */
.hero-default {
  background: linear-gradient(135deg, #2d0a0a 0%, #7a1a1a 60%, #c0392b 100%);
  min-height: 300px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 3rem 1.5rem;
}
.hero-texto { color: var(--blanco); }
.hero-texto h1 { font-size: clamp(1.6rem, 4vw, 2.8rem); font-weight: 800; margin-bottom: .75rem; }
.hero-texto p { font-size: 1.1rem; opacity: .9; margin-bottom: 1.5rem; }

/* ---- SECCIÓN CÓMO FUNCIONA ---- */
.como-funciona { padding: 3.5rem 0; background: var(--blanco); }
.section-title {
  text-align: center; font-size: 1.7rem; font-weight: 700;
  margin-bottom: 2rem; color: var(--texto);
}
.section-title::after {
  content: ''; display: block; width: 48px; height: 4px;
  background: var(--rojo); border-radius: 2px; margin: .5rem auto 0;
}
.pasos-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem;
}
.paso {
  text-align: center; padding: 1.5rem 1rem;
  border-radius: var(--radio); background: var(--gris-cl);
  border: 1px solid var(--borde);
}
.paso-icono { font-size: 2.2rem; margin-bottom: .75rem; }
.paso h3 { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.paso p { font-size: .9rem; color: var(--gris); }

/* ---- CATÁLOGO ---- */
.catalogo { padding: 3.5rem 0; }
.sin-lotes { text-align: center; padding: 3rem; color: var(--gris); font-size: 1.1rem; }

.lotes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem;
}
.lote-card {
  background: var(--blanco); border-radius: var(--radio);
  border: 1.5px solid var(--borde); overflow: hidden;
  box-shadow: var(--sombra); transition: box-shadow var(--trans), transform var(--trans);
  position: relative;
}
.lote-card:hover { box-shadow: var(--sombra-h); transform: translateY(-3px); }
.lote-card.destacado { border-color: var(--dorado); }
.lote-card.oferta { border-color: var(--rojo); }

.badge {
  position: absolute; top: .8rem; left: .8rem; z-index: 1;
  padding: .25rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
}
.badge-top { background: var(--dorado); color: var(--blanco); }
.badge-oferta { background: var(--rojo); color: var(--blanco); }

.lote-imagen { height: 200px; overflow: hidden; background: var(--gris-cl); }
.lote-imagen img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.lote-card:hover .lote-imagen img { transform: scale(1.04); }
.lote-imagen-placeholder {
  height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 4rem; color: #d1d5db;
}

.lote-info { padding: 1.1rem 1.1rem 1.25rem; }
.lote-nombre { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.lote-desc { font-size: .88rem; color: var(--gris); margin-bottom: .6rem; line-height: 1.5; }

.lote-contenido { margin-bottom: .8rem; }
.lote-contenido summary {
  font-size: .85rem; color: var(--rojo); cursor: pointer; font-weight: 500;
}
.lote-contenido ul { margin-top: .5rem; padding-left: 1.2rem; }
.lote-contenido li { font-size: .85rem; color: var(--gris); }

.lote-precio-area { margin-bottom: .9rem; }
.precio-anterior {
  text-decoration: line-through; color: var(--gris); font-size: .9rem; margin-right: .4rem;
}
.precio-principal { font-size: 1.5rem; font-weight: 800; color: var(--rojo); }
.precio-iva-nota { font-size: .78rem; color: var(--gris); margin-left: .3rem; }

.btn-añadir {
  width: 100%; padding: .6rem 1rem; border: none;
  border-radius: var(--radio-sm); font-size: .95rem; font-weight: 600;
  background: var(--rojo); color: var(--blanco); cursor: pointer;
  transition: background var(--trans);
}
.btn-añadir:hover { background: var(--rojo-osc); }
.btn-agotado { background: #d1d5db !important; color: var(--gris) !important; cursor: not-allowed !important; }

/* ---- FOOTER ---- */
.footer { background: #1c1c1c; color: #d1d5db; padding: 2.5rem 0 1.5rem; }
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem; margin-bottom: 1.5rem;
}
.footer h4 { color: var(--blanco); font-size: .95rem; margin-bottom: .5rem; }
.footer a { color: #a8a29e; font-size: .88rem; }
.footer a:hover { color: var(--blanco); }
.footer-bottom { border-top: 1px solid #333; padding-top: 1rem; text-align: center; font-size: .8rem; color: #6b7280; }

/* ---- CARRITO LATERAL ---- */
.carrito-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 300;
}
.carrito-overlay.open { display: block; }
.carrito-panel {
  position: fixed; top: 0; right: -420px; width: min(420px, 100vw); height: 100vh;
  background: var(--blanco); z-index: 301; box-shadow: -4px 0 24px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  transition: right .28s cubic-bezier(.4,0,.2,1);
}
.carrito-panel.open { right: 0; }
.carrito-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--borde);
  font-weight: 700; font-size: 1.05rem;
}
.carrito-cerrar {
  background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--gris);
}
.carrito-items { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.carrito-vacio { text-align: center; color: var(--gris); padding: 2rem 0; }
.carrito-item {
  display: flex; gap: .8rem; padding: .8rem 0;
  border-bottom: 1px solid var(--borde); align-items: center;
}
.carrito-item-info { flex: 1; }
.carrito-item-nombre { font-weight: 600; font-size: .92rem; }
.carrito-item-precio { font-size: .9rem; color: var(--rojo); }
.carrito-item-ctrl { display: flex; align-items: center; gap: .4rem; }
.carrito-item-ctrl button {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--borde);
  background: var(--gris-cl); cursor: pointer; font-size: .85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.carrito-item-ctrl span { font-weight: 600; min-width: 20px; text-align: center; }
.carrito-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--borde); }
.carrito-total {
  display: flex; justify-content: space-between; margin-bottom: .8rem;
  font-size: 1rem; font-weight: 600;
}

/* ---- MODALES ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 400; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--blanco); border-radius: var(--radio); padding: 2rem;
  width: 100%; max-width: 440px; position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-grande { max-width: 600px; }
.modal-cerrar {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--gris);
}
.modal h2 { margin-bottom: 1.25rem; font-size: 1.3rem; }
.modal h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .75rem; color: var(--texto); }
.modal-link { margin-top: 1rem; text-align: center; font-size: .88rem; color: var(--gris); }

.form-group { margin-bottom: .9rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .3rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: .55rem .8rem; border: 1.5px solid var(--borde);
  border-radius: var(--radio-sm); font-size: .92rem; color: var(--texto);
  transition: border-color var(--trans);
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--rojo);
}
.form-group small { font-size: .78rem; color: var(--gris); margin-top: .2rem; display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-error {
  background: var(--rojo-cl); color: var(--rojo); border: 1px solid #fca5a5;
  border-radius: var(--radio-sm); padding: .6rem .9rem; font-size: .88rem;
  margin-bottom: .8rem;
}

/* Pago */
.pago-opciones { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.pago-opcion {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem; border: 1.5px solid var(--borde); border-radius: var(--radio-sm);
  cursor: pointer; transition: border-color var(--trans), background var(--trans);
}
.pago-opcion:has(input:checked) { border-color: var(--rojo); background: var(--rojo-cl); }
.pago-opcion input { accent-color: var(--rojo); }
.pago-opcion span { font-size: .92rem; font-weight: 500; }

.checkout-resumen {
  background: var(--gris-cl); border-radius: var(--radio-sm); padding: .9rem 1rem;
  margin: 1rem 0; font-size: .9rem;
}
.checkout-login-aviso { text-align: center; padding: 1rem 0; }
.checkout-login-aviso p { margin-bottom: 1rem; color: var(--gris); }
.checkout-login-aviso .btn-primary, .checkout-login-aviso .btn-secondary {
  margin: .3rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: .75rem 1rem; gap: .5rem; }
  .header-nav { gap: .4rem; }
  .nav-link { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .lotes-grid { grid-template-columns: 1fr; }
}
