/* ==============================================================================
   GUARDALIBRE STOREFRONT - CATÁLOGO PÚBLICO PARA CLIENTES (PROMAX DESIGN)
   ============================================================================== */

:root {
  --store-primary: #2563eb;
  --store-primary-hover: #1d4ed8;
  --store-primary-light: #eff6ff;
  --store-accent: #16a34a;
  --store-bg: #f8fafc;
  --store-surface: #ffffff;
  --store-text-main: #0f172a;
  --store-text-muted: #64748b;
  --store-text-subtle: #94a3b8;
  --store-border: #e2e8f0;
  --store-radius: 12px;
  --store-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --store-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
  --store-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--store-bg);
  color: var(--store-text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header de la Tienda */
.store-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--store-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--store-shadow-sm);
}

.store-header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.store-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.store-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--store-primary-light);
  border: 1px solid var(--store-border);
}

.store-title-wrap h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--store-text-main);
}

.store-badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #166534;
  background: #f0fdf4;
  padding: 1px 7px;
  border-radius: 9999px;
  border: 1px solid #bbf7d0;
}

.store-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-contact-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25d366;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-contact-whatsapp:hover {
  background: #1eb857;
  transform: translateY(-1px);
}

.btn-cart-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--store-primary);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-cart-trigger:hover {
  background: var(--store-primary-hover);
  transform: translateY(-1px);
}

.cart-count-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
}

/* Banner de la Tienda */
.store-hero {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 32px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.store-hero::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 120%, rgba(37, 99, 235, 0.25), transparent 70%);
  pointer-events: none;
}

.store-hero-content {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.store-hero-content h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.store-hero-content p {
  font-size: 0.95rem;
  color: #94a3b8;
  margin-bottom: 20px;
}

/* Barra de Búsqueda y Filtros */
.store-search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 10px;
  padding: 4px 14px;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.store-search-box svg {
  color: #94a3b8;
  flex-shrink: 0;
}

.store-search-box input {
  width: 100%;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 0.92rem;
  color: var(--store-text-main);
  background: transparent;
}

/* Categorías PillTabs */
.store-categories-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--store-border);
  padding: 10px 20px;
  position: sticky;
  top: 69px;
  z-index: 90;
}

.store-categories-list {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.store-categories-list::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  border: 1px solid var(--store-border);
  background: var(--store-surface);
  color: var(--store-text-muted);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  background: var(--store-primary-light);
  color: var(--store-primary);
  border-color: #bfdbfe;
}

.cat-pill.active {
  background: var(--store-primary);
  color: #ffffff;
  border-color: var(--store-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Cuadrícula de Productos */
.store-main-container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 20px;
  flex: 1;
  width: 100%;
}

.store-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Tarjeta de Producto */
.store-card {
  background: var(--store-surface);
  border: 1px solid var(--store-border);
  border-radius: var(--store-radius);
  overflow: hidden;
  box-shadow: var(--store-shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.store-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--store-shadow-md);
  border-color: #cbd5e1;
}

.store-card-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--store-border);
}

.store-card-img-wrap.aspect-4-5 {
  aspect-ratio: 4 / 5;
}

.store-card-img-wrap img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.store-card:hover .store-card-img-wrap img {
  transform: scale(1.05);
}

.store-card-badge-stock {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.store-card-badge-stock.in-stock {
  color: #166534;
  border: 1px solid #bbf7d0;
}

.store-card-badge-stock.low-stock {
  color: #854d0e;
  border: 1px solid #fef08a;
}

.store-card-badge-stock.out-of-stock {
  color: #991b1b;
  border: 1px solid #fecaca;
}

.store-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.store-card-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--store-primary);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.store-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--store-text-main);
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 12px;
}

.store-card-price-row {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.store-card-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--store-text-main);
}

.store-card-currency {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--store-text-muted);
  margin-left: 3px;
}

.btn-add-to-cart {
  width: 100%;
  background: var(--store-primary);
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-add-to-cart:hover {
  background: var(--store-primary-hover);
}

.btn-add-to-cart:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.btn-cart-text-mobile {
  display: none;
}

.btn-cart-text-desktop {
  display: inline;
}

/* Drawer del Carrito */
.cart-drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cart-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: #ffffff;
  box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-drawer-overlay.active .cart-drawer {
  right: 0;
}

.cart-drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--store-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--store-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--store-text-muted);
  line-height: 1;
}

.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--store-border);
  border-radius: 8px;
  background: #f8fafc;
}

.cart-item-thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--store-border);
}

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

.cart-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--store-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--store-primary);
  margin-top: 2px;
}

.cart-item-qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--store-border);
  background: #ffffff;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-qty-num {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

/* Footer y Checkout */
.cart-drawer-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--store-border);
  background: #ffffff;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.cart-total-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--store-text-muted);
}

.cart-total-val {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--store-text-main);
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.checkout-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--store-border);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.checkout-input:focus {
  border-color: var(--store-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-submit-order-whatsapp {
  width: 100%;
  background: #25d366;
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-submit-order-whatsapp:hover {
  background: #1eb857;
  transform: translateY(-1px);
}

/* Footer de la página */
.store-footer {
  background: #ffffff;
  border-top: 1px solid var(--store-border);
  padding: 24px 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--store-text-muted);
  margin-top: auto;
}

/* Modal de Confirmación de Pedido */
.order-success-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.order-success-card {
  background: #ffffff;
  max-width: 460px;
  width: 100%;
  border-radius: 16px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: var(--store-shadow-lg);
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVIDAD PROMAX CANONIZADA (ESCRITORIO, TABLET Y MÓVIL)
   ========================================================================== */

/* 1. TABLET (768px - 1024px) */
@media (max-width: 1024px) {
  .store-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
  }

  .store-main-container {
    padding: 0 16px;
    margin: 18px auto;
  }

  .store-hero {
    padding: 28px 16px;
  }

  .cart-drawer {
    max-width: 380px;
  }
}

/* 2. MÓVIL Y TABLET VERTICAL (< 768px) */
@media (max-width: 768px) {
  .btn-cart-text-desktop {
    display: none;
  }
  .btn-cart-text-mobile {
    display: inline;
  }

  .store-main-container {
    padding: 0 12px;
    margin: 14px auto;
  }

  .store-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .store-card {
    border-radius: 12px;
  }

  .store-card-img-wrap {
    aspect-ratio: 1 / 1;
    border-radius: 12px 12px 0 0;
  }

  .store-card-img-wrap img {
    width: 88%;
    height: 88%;
    object-fit: contain;
  }

  .store-card-badge-stock {
    top: 6px;
    left: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    gap: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  }

  .store-card-badge-stock span {
    width: 5px !important;
    height: 5px !important;
  }

  .store-header-container {
    padding: 10px 14px;
  }

  .store-categories-bar {
    top: 60px;
    padding: 8px 12px;
  }

  .store-categories-list {
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .cat-pill {
    padding: 5px 12px;
    font-size: 0.78rem;
    min-height: 34px;
  }

  .store-hero {
    padding: 20px 14px;
  }

  .store-hero-content h2 {
    font-size: 1.3rem;
  }

  .btn-contact-whatsapp span {
    display: none;
  }

  .btn-contact-whatsapp {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
    justify-content: center;
    border-radius: 8px;
  }

  .cart-drawer {
    width: 100%;
    max-width: 100%;
    right: -100%;
  }

  .store-card-body {
    padding: 10px;
  }

  .store-card-category {
    font-size: 0.65rem;
    margin-bottom: 2px;
    letter-spacing: 0.3px;
  }

  .store-card-title {
    font-size: 0.78rem;
    line-height: 1.35;
    min-height: 2.7em;
    max-height: 2.7em;
    height: auto;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 6px;
  }

  .store-card-price-row {
    margin-bottom: 8px;
  }

  .store-card-price {
    font-size: 1.15rem;
    font-weight: 800;
  }

  .store-card-currency {
    font-size: 0.7rem;
    font-weight: 700;
  }

  .btn-add-to-cart {
    min-height: 38px;
    padding: 7px 6px;
    font-size: 0.78rem;
    border-radius: 8px;
    gap: 5px;
    white-space: nowrap;
  }
}

/* 3. MÓVIL PEQUEÑO (< 480px - ANDROID) */
@media (max-width: 480px) {
  .store-header-container {
    padding: 8px 10px;
  }

  .store-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .store-title-wrap h1 {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .store-badge-verified {
    font-size: 0.65rem;
    padding: 1px 5px;
  }

  #store-location-text {
    font-size: 0.68rem !important;
  }

  .store-actions {
    gap: 6px;
  }

  .btn-contact-whatsapp {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .btn-cart-trigger {
    padding: 6px 10px;
    font-size: 0.8rem;
    gap: 5px;
    border-radius: 8px;
  }

  .btn-cart-trigger .btn-cart-label {
    display: none;
  }

  .store-hero {
    padding: 16px 10px;
  }

  .store-hero-content h2 {
    font-size: 1.15rem;
    margin-bottom: 4px;
  }

  .store-hero-content p {
    font-size: 0.8rem;
    margin-bottom: 12px;
  }

  .store-search-box {
    padding: 3px 10px;
    border-radius: 8px;
  }

  .store-search-box input {
    padding: 8px 6px;
    font-size: 0.82rem;
  }

  .store-categories-bar {
    top: 54px;
    padding: 6px 10px;
  }

  .cat-pill {
    padding: 4px 10px;
    font-size: 0.72rem;
    min-height: 30px;
  }

  .store-main-container {
    padding: 0 8px;
    margin: 10px auto;
  }

  .store-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .store-card {
    border-radius: 10px;
  }

  .store-card-img-wrap {
    border-radius: 10px 10px 0 0;
  }

  .store-card-body {
    padding: 8px 6px 10px 6px;
  }

  .store-card-category {
    font-size: 0.62rem;
    margin-bottom: 2px;
  }

  .store-card-title {
    font-size: 0.74rem;
    line-height: 1.32;
    min-height: 2.65em;
    max-height: 2.65em;
    height: auto;
    margin-bottom: 6px;
  }

  .store-card-price-row {
    margin-bottom: 6px;
  }

  .store-card-price {
    font-size: 1.02rem;
  }

  .store-card-currency {
    font-size: 0.65rem;
  }

  .btn-add-to-cart {
    padding: 6px 4px;
    font-size: 0.72rem;
    min-height: 34px;
    border-radius: 6px;
    gap: 4px;
  }

  .order-success-card {
    padding: 20px 14px;
  }
}

/* Modal de Galería de Fotos de Producto */
.product-gallery-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.product-gallery-modal-card {
  background: #ffffff;
  border-radius: var(--store-radius);
  max-width: 520px;
  width: 100%;
  padding: 20px;
  box-shadow: var(--store-shadow-lg);
  animation: modalEnter 0.2s ease-out;
}

.modal-gallery-thumb-btn {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  border: 2px solid var(--store-border);
  padding: 2px;
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.modal-gallery-thumb-btn.active {
  border-color: var(--store-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.modal-gallery-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Dots interactivos en la tarjeta de producto */
.card-gallery-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  z-index: 5;
}

.card-gallery-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-gallery-dot.active {
  background: var(--store-primary);
  width: 14px;
  border-radius: 4px;
}

