:root {
  --primary: #000000;
  --primary-hover: #1f1f1f;
  --gold: #d4af37;
  --gold-hover: #b89628;
  --bg-light: #f4f4f4;
  --card-bg: #ffffff;
  --text-main: #222222;
  --text-muted: #666666;
  --border-color: #e5e5e5;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.15);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-light);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* HEADER RESPONSIVO Y MODERNO */
.header-main {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.2s ease;
}
.brand-logo:hover {
  transform: scale(1.02);
}

.brand-logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.brand-title {
  display: flex;
  flex-direction: column;
}
.brand-title .main-name {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #000;
  line-height: 1;
}
.brand-title .sub-name {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--gold);
  text-transform: uppercase;
}

/* MENÚ BOTÓN CATEGORÍAS */
.categories-btn-wrapper {
  position: relative;
}

.btn-categories-trigger {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-categories-trigger:hover {
  background: var(--gold);
  color: #000;
  transform: translateY(-1px);
}

/* BARRA DE CATEGORÍAS RÁPIDAS */
.quick-categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  max-width: 1280px;
  margin: 0 auto;
  scrollbar-width: none;
}
.quick-categories-bar::-webkit-scrollbar {
  display: none;
}
.quick-cat-pill {
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  background: #f0f0f0;
  color: #333;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}
.quick-cat-pill:hover, .quick-cat-pill.active {
  background: var(--primary);
  color: var(--gold);
  border-color: var(--gold);
  transform: translateY(-1px);
}

/* MEGA MENU DESPLEGABLE TIPO FALABELLA */
/* MEGA MENU MEJORADO - FULL UX */
.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 900px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  display: none;
  grid-template-columns: 280px 1fr;
  z-index: 200;
  border: 1px solid var(--border-color);
  margin-top: 8px;
  overflow: hidden;
  height: 550px;
  animation: fadeInDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mega-menu.active {
  display: grid;
}

.mega-categories-list {
  background: #f9f9f9;
  border-right: 1px solid var(--border-color);
  padding: 8px 0;
  overflow-y: auto;
  height: 100%;
}

.cat-item {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #333;
  transition: all 0.2s ease;
}
.cat-item:hover, .cat-item.active {
  background: #ffffff;
  color: var(--gold);
  border-left: 4px solid var(--gold);
}

.mega-subcategories-container {
  padding: 30px;
  overflow-y: auto;
  background: #fff;
  height: 100%;
}

.subcat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-content: start;
}

.subcat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #eee;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  height: fit-content;
  min-height: 50px;
}

.subcat-item:hover {
  border-color: var(--gold);
  background: #fef9e7;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.subcat-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  line-height: 1.2;
}

/* Botón Regresar Móvil */
.btn-back-menu {
  display: none;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border: none;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 20px;
  cursor: pointer;
  width: 100%;
}

@media (max-width: 768px) {
  .mega-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    grid-template-columns: 1fr;
    z-index: 1000;
    margin-top: 0;
    border-radius: 0;
  }
  
  .mega-menu.mobile-show-subs .mega-categories-list {
    display: none;
  }
  
  .mega-menu.mobile-show-subs .mega-subcategories-container {
    display: block;
  }
  
  .mega-subcategories-container {
    display: none;
    padding: 20px;
  }
  
  .btn-back-menu {
    display: flex;
  }
}

/* BUSCADOR */
.header-search {
  flex: 1;
  max-width: 440px;
}
.search-input-wrapper {
  display: flex;
  align-items: center;
  background: #f4f4f4;
  border-radius: 20px;
  padding: 3px 12px;
  transition: all 0.25s ease;
  border: 1.5px solid transparent;
}
.search-input-wrapper:focus-within {
  background: #ffffff;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
}

.search-input-wrapper input {
  border: none;
  background: transparent;
  width: 100%;
  padding: 6px;
  font-size: 0.85rem;
  outline: none;
}
.search-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  transition: color 0.2s;
}
.search-btn:hover {
  color: var(--gold);
}

/* BOTONES HEADER */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  font-size: 0.7rem;
  font-weight: 600;
  position: relative;
  transition: transform 0.2s ease;
}
.action-btn:hover {
  transform: translateY(-1px);
  color: var(--gold);
}

.action-btn svg {
  width: 20px;
  height: 20px;
}
.cart-badge {
  position: absolute;
  top: -4px;
  right: 0px;
  background: var(--gold);
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* LAYOUT PRINCIPAL */
.main-layout {
  max-width: 1280px;
  margin: 16px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}

.sidebar-filters {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  height: fit-content;
}

.category-tree-list {
  list-style: none;
}
.category-tree-link {
  font-size: 0.85rem;
  color: #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}
.category-tree-link:hover, .category-tree-link.active {
  background: #f4f4f4;
  color: var(--gold);
  font-weight: 700;
}
.subcategory-sub-list {
  list-style: none;
  padding-left: 12px;
  margin-top: 2px;
  display: none;
}
.subcategory-sub-list.open {
  display: block;
}

.content-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-banner {
  background: linear-gradient(135deg, #000000 0%, #2a2a2a 100%);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  color: #ffffff;
  box-shadow: var(--shadow-md);
}
.hero-content h1 {
  font-size: 1.4rem;
  font-weight: 900;
}
.hero-content h1 span {
  color: var(--gold);
}
.hero-content p {
  font-size: 0.85rem;
  color: #ccc;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* GRILLA DE PRODUCTOS Y ANIMACIÓN TARJETAS */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.product-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(212,175,55,0.4);
}

.product-img-wrapper {
  width: 100%;
  height: 180px;
  background: #f9f9f9;
  position: relative;
  overflow: hidden;
}
.product-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.product-card:hover .product-img-wrapper img {
  transform: scale(1.06);
}

.badge-stock {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.85);
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(2px);
}

.badge-ref {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(212,175,55,0.9);
  color: #000;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.product-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 4px 0;
  line-height: 1.2;
  height: 2.4em;
  overflow: hidden;
}
.price-main {
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary);
  margin-top: 4px;
}
.btn-add-cart {
  width: 100%;
  margin-top: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-add-cart:hover {
  background: var(--gold);
  color: #000;
}

/* BOTÓN CHECKOUT Y OTROS BOTONES ACCIÓN */
.btn-checkout {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-checkout:hover {
  background: var(--gold);
  color: #000;
}

#comprobante-preview-container {
  display: none;
  margin-top: 12px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  text-align: center;
}

#comprobante-preview-img {
  max-width: 100%;
  max-height: 250px;
  border-radius: var(--radius-sm);
  display: block;
  margin: 8px auto 0;
  box-shadow: var(--shadow-sm);
}

/* DRAWER CARRITO - PERFECTO Y ESTÉTICO */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  z-index: 600;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.cart-drawer.active {
  right: 0;
}

.cart-header, .cart-footer {
  padding: 16px 20px;
}
.cart-items-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.cart-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.cart-item-img {
  width: 75px;
  height: 75px;
  min-width: 75px;
  min-height: 75px;
  max-width: 75px;
  max-height: 75px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f9f9f9;
  border: 1px solid var(--border-color);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 14px;
}

/* MODALES RESPONSIVOS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-md);
  max-width: 600px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: zoomIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
}

.detail-img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #f9f9f9;
  border: 1px solid var(--border-color);
}

@media (max-width: 600px) {
  .product-detail-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #f0f0f0;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-close-btn:hover {
  background: #e0e0e0;
}

/* MODALES RESPONSIVOS Y FORMULARIOS MEJORADOS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}
.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 92%;
  max-height: 95vh;
  overflow-y: auto;
  position: relative;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.checkout-header {
  margin-bottom: 24px;
  text-align: center;
}

.checkout-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.checkout-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.checkout-step {
  margin-bottom: 30px;
}

.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

.step-number {
  background: var(--gold);
  color: #000;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  width: 18px;
  height: 18px;
}

.input-with-icon .form-control {
  padding-left: 40px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #eee;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
  background: #fdfdfd;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
}

/* Caja de Pago Estilizada */
.payment-card {
  background: #fff;
  border: 2px solid #f0f0f0;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.bank-info-box {
  background: linear-gradient(135deg, #fef9e7 0%, #fcf3cf 100%);
  border: 1px solid #f7dc6f;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(212,175,55,0.3);
}

.bank-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.bank-label {
  font-size: 0.8rem;
  color: #7d6608;
  font-weight: 600;
  text-transform: uppercase;
}

.bank-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a1a;
}

/* Upload Area */
.file-upload-wrapper {
  position: relative;
  border: 2px dashed #ddd;
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  background: #fafafa;
}

.file-upload-wrapper:hover {
  border-color: var(--gold);
  background: #fef9e7;
}

.file-upload-wrapper input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.upload-text {
  font-size: 0.9rem;
  color: #666;
}

.upload-text strong {
  color: var(--primary);
}

.btn-confirm-order {
  width: 100%;
  background: var(--primary);
  color: var(--gold);
  border: none;
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.btn-confirm-order:hover {
  background: #222;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.btn-confirm-order:disabled {
  background: #999;
  cursor: not-allowed;
  transform: none;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 1s linear infinite;
}

footer {
  background: #111;
  color: #aaa;
  padding: 20px;
  margin-top: 40px;
}

/* MEDIA QUERIES PARA CELULAR */
@media (max-width: 768px) {
  .header-container {
    flex-wrap: wrap;
  }
  .header-search {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin-top: 4px;
  }
  .brand-title .main-name {
    font-size: 1.1rem;
  }
  .brand-title .sub-name {
    font-size: 0.5rem;
  }
  .main-layout {
    grid-template-columns: 1fr;
    margin: 10px auto;
    padding: 0 10px;
  }
  .sidebar-filters {
    display: none;
  }
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .product-img-wrapper {
    height: 140px;
  }
  .product-info {
    padding: 8px;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
  .mega-menu {
    position: fixed;
    top: 60px;
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
    grid-template-columns: 1fr;
    max-height: 80vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  }
}
