/* =========================
   RESET GLOBAL
========================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f5f7fb;
  color: #1f2937;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;              /* más gordita */
  letter-spacing: 0.3px;         /* más elegante */
}

/* =========================
   CONTENEDOR GENERAL
========================= */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* =========================
   HEADER
========================= */
header {
  background: linear-gradient(90deg, #2b0a5f, #13003b);
  border-bottom: none;
}


.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.brand-logo {
  height: 52px;
  width: auto;
  display: block;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

nav a {
  text-decoration: none;
  font-weight: 500;
  color: #e5e7eb;
}

nav a:hover {
    color: #38bdf8;

}

/* =========================
   PAGE HEAD
========================= */
.page-head {
    background: #ede9fe;
  border-bottom: 1px solid #e5e7eb;
  padding: 24px 0;
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 28px;
  margin-bottom: 6px;
  color: #2b0a5f;

}

.page-head .muted {
    color: #475569;
  font-size: 14px;
}

/* =========================
   FILTROS
========================= */
.filters {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.filters input,
.filters select,
.filters button {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.filters input,
.filters select {
  background: #ffffff;
}

.filters button {
    background: #7c3aed;
  color: #ffffff;
  border: none;
  cursor: pointer;
}

.filters button:hover {
    background: #6d28d9;
}

/* =========================
   GRID DE PRODUCTOS
========================= */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

/* =========================
   CARD PRODUCTO
========================= */
.producto-card {
    border: 1px solid #e0e7ff;
    background: #ffffff;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.producto-card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* =========================
   IMAGEN
========================= */
.producto-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  margin-bottom: 12px;
}

/* =========================
   TEXTO
========================= */
.producto-card h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.producto-card .marca {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

.producto-card .stock {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #16a34a;
}

.producto-card .stock::before {
  content: "● ";
  color: #16a34a;
}

/* =========================
   BOTÓN
========================= */
.btn-detalle {
  margin-top: auto;
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: #7c3aed;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}

.btn-detalle:hover {
    background: #6d28d9;
}

/* =========================
   ESTADOS
========================= */
.state-box {
  text-align: center;
  padding: 40px;
  color: #6b7280;
  font-size: 14px;
}

/* =========================
   CARRITO (BASE)
========================= */
.carrito-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -10px 0 24px rgba(0,0,0,0.08);
  transition: right 0.3s ease;
  z-index: 1000;
}

.carrito-panel.active {
  right: 0;
}

.carrito-header {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.carrito-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {
  .header-flex {
    flex-direction: column;
    gap: 12px;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }

  .productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* =========================
   PAGINACIÓN
========================= */
.paginacion {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 30px 0;
}

.paginacion button {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #c7d2fe;
  background: #ffffff;
  cursor: pointer;
  font-size: 14px;
}

.paginacion button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.paginacion span {
  font-size: 14px;
  color: #374151;
}




/* ====== PANEL CARRITO ====== */
.carrito-panel{
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -12px 0 30px rgba(0,0,0,0.12);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right .25s ease;
}

.carrito-panel.open{
  right: 0;
}

.carrito-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.cerrar-carrito{
  font-size: 26px;
  cursor:pointer;
  user-select:none;
}

.carrito-contenido{
  flex: 1;
  overflow:auto;
  padding: 10px 12px;
}

.cart-item{
  display:flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 10px;
}

.cart-item-img{
  width: 72px;
  height: 72px;
  background:#f9fafb;
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border: 1px solid #eef2f7;
}

.cart-item-img img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cart-item-info{
  flex: 1;
  min-width: 0;
}

.cart-item-title{
  font-weight: 800;
  font-size: 13px;
  line-height: 1.25;
  margin-bottom: 6px;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}

.cart-item-price{
  font-weight: 800;
  margin-bottom: 10px;
}

.cart-item-actions{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}

.qty-btn{
  width: 34px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background:#fff;
  cursor:pointer;
  font-size: 16px;
  font-weight: 800;
}

.qty-num{
  min-width: 22px;
  text-align:center;
  font-weight: 800;
}

.remove-btn{
  margin-left: auto;
  border: 1px solid #ef4444;
  background: #fff;
  color: #b91c1c;
  padding: 8px 10px;
  border-radius: 10px;
  cursor:pointer;
  font-weight: 800;
  font-size: 12px;
}

.carrito-footer{
  border-top: 1px solid #e5e7eb;
  padding: 14px 16px;
}

.resumen-costos{
  display:flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.resumen-item{
  display:flex;
  justify-content: space-between;
  color:#374151;
  font-weight: 700;
}

.resumen-item.total{
  font-size: 16px;
  color:#111827;
}

@media (max-width: 520px){
  .carrito-panel{ width: 100%; right: -100%; }
}



/* =========================
   NAV CATÁLOGO – MOBILE FRIENDLY
========================= */

.catalog-nav {
  background: linear-gradient(90deg, #2b0a5f, #13003b);
  padding: 12px 0;
}

.catalog-nav .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  padding: 0 12px;
}

/* Links base */
.catalog-nav .nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: #e5e7eb;
  background: rgba(255,255,255,0.08);
  transition: all .2s ease;
  white-space: nowrap;
}

.catalog-nav .nav-links a:hover {
  background: rgba(56,189,248,0.18);
  color: #38bdf8;
}

/* Carrito destacado */
.catalog-nav .cart-link a {
  background: #7c3aed;
  color: #fff;
  font-weight: 600;
}

.catalog-nav .cart-link a:hover {
  background: #6d28d9;
}

/* =========================
   DESKTOP – más simple
========================= */
@media (min-width: 769px) {
  .catalog-nav .nav-links {
    justify-content: flex-start;
    gap: 20px;
    padding: 0;
  }

  .catalog-nav .nav-links a {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 15px;
  }

  .catalog-nav .cart-link a {
    background: transparent;
    color: #e5e7eb;
  }
}



/* =========================
   NAV SUPERIOR – TIPOGRAFÍA PRO
========================= */

/* Links del nav superior */
header nav a {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;              /* más gordita */
  letter-spacing: 0.3px;         /* más elegante */
  font-size: 15px;
  color: #e5e7eb;
  transition: color 0.2s ease, transform 0.2s ease;
}

/* Hover más fino */
header nav a:hover {
  color: #38bdf8;
  transform: translateY(-1px);
}

/* En móvil un poco más grande para dedo */
@media (max-width: 768px) {
  header nav a {
    font-size: 15.5px;
    font-weight: 600;
  }
}

.checkout-box{margin-top:12px;display:flex;flex-direction:column;gap:10px}
.btn-checkout{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(180deg, rgba(99,102,241,.95), rgba(79,70,229,.88));
  color:#fff;
  font-weight:700;
  cursor:pointer;
}
.btn-checkout:hover{filter:brightness(1.05)}
.checkout-note{font-size:12.5px;color:rgba(255,255,255,.70);line-height:1.35}


/* ===== FIX MOBILE SAFARI ===== */
.carrito-panel {
  height: 100dvh; /* viewport dinámico real */
  max-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Footer del carrito siempre visible */
.carrito-footer {
  position: sticky;
  bottom: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* =========================
   ELIMINAR BOTÓN VIEJO "IR A PAGAR"
========================= */

/* Oculta cualquier botón NO sticky dentro del footer */
#carrito-panel .carrito-footer > button {
  display: none !important;
}

/* Deja SOLO el botón final (el bueno) */
#carrito-panel .carrito-footer .checkout-sticky,
#carrito-panel .carrito-footer #btn-checkout {
  display: flex !important;
}