/* ==========================================================================
   COMPONENTES UI - HERO, FILTROS, TARJETAS, MODAL, UBICACIÓN Y CARRITO
   ========================================================================== */

/* 1. Hero Banner */
.hero {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 3.5rem 0;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(194, 65, 12, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(255, 255, 255, 0.1);
  color: #fdba74;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  border: 1px solid rgba(253, 186, 116, 0.25);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-title span {
  color: #fdba74;
}

.hero-description {
  font-size: 1.1rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.hero-feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #f1f5f9;
}

.hero-feature-item svg {
  color: #fdba74;
}

/* 2. Barra de Filtros y Búsqueda */
.filters-section {
  padding: 2rem 0 1rem;
}

.filter-categories {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.filter-chip {
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: var(--transition);
}

.filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-chip.active {
  background-color: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.filter-chip-offer {
  border-color: #10b981;
  color: #059669;
  background-color: rgba(16, 185, 129, 0.08);
}

.filter-chip-offer:hover {
  background-color: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

.filter-chip-offer.active {
  background-color: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: var(--bg-surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.filter-dropdowns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.filter-select {
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--color-accent);
}

.results-count {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 3. Grid de Productos */
.products-section {
  padding: 1.5rem 0 3.5rem;
}

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

/* Tarjeta de Producto */
.product-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

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

.product-image-wrap {
  position: relative;
  width: 100%;
  padding-top: 110%;
  background-color: #e2e8f0;
  overflow: hidden;
  cursor: pointer;
}

.product-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.product-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 2;
}

.badge-tag {
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-unique {
  background-color: var(--color-accent);
}

.badge-offer {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.45);
}

.product-size-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background-color: rgba(255, 255, 255, 0.95);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: var(--color-primary);
}

.product-info {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.product-brand {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-accent);
  letter-spacing: 0.04em;
}

.product-condition {
  font-size: 0.75rem;
  color: var(--color-success);
  font-weight: 600;
}

.product-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.product-name:hover {
  color: var(--color-accent);
}

.product-status-pill {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  background-color: var(--bg-subtle);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.product-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.product-pricing {
  display: flex;
  flex-direction: column;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
}

.product-original-estimate {
  font-size: 0.78rem;
  color: var(--text-light);
  text-decoration: line-through;
}

.btn-add-cart {
  background-color: var(--color-primary);
  color: #ffffff;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-add-cart:hover {
  background-color: var(--color-accent);
}

/* 4. Sección de Ubicación y Mapa (Temuco) */
.location-section {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 3.5rem 0;
  margin-bottom: 0;
}

.location-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 840px) {
  .location-grid {
    grid-template-columns: 1.1fr 1fr;
  }
}

.location-info h2 {
  font-size: 1.85rem;
  margin-bottom: 0.75rem;
}

.location-info p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.delivery-options-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.delivery-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.delivery-card-icon {
  font-size: 1.35rem;
}

.delivery-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.delivery-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin: 0;
}

.map-container {
  width: 100%;
  height: 340px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* 5. Carrito Lateral (Drawer) */
.cart-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  background-color: var(--bg-surface);
  z-index: 101;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-drawer.open {
  right: 0;
}

.cart-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-header h3 {
  font-size: 1.15rem;
}

.btn-close {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0.25rem;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-empty {
  text-align: center;
  margin: auto 0;
  color: var(--text-muted);
}

.cart-empty svg {
  margin-bottom: 1rem;
  color: var(--text-light);
}

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

.cart-item-img {
  width: 65px;
  height: 65px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: var(--bg-subtle);
}

.cart-item-info {
  flex: 1;
}

.cart-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.cart-item-details {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cart-item-price {
  font-weight: 800;
  color: var(--color-primary);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.cart-item-remove {
  color: #ef4444;
  font-size: 0.85rem;
  padding: 0.4rem;
}

/* Calculadora de Despacho y KM en el Carrito */
.delivery-calculator-box {
  margin-top: 0.75rem;
  padding: 1rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.delivery-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  display: block;
  margin-bottom: 0.6rem;
}

.delivery-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.delivery-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background-color: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.delivery-radio-card.active {
  border-color: var(--color-accent);
  background-color: #fffaf5;
}

.delivery-radio-card input {
  margin-top: 0.2rem;
  accent-color: var(--color-accent);
}

.delivery-radio-card strong {
  display: block;
  font-size: 0.82rem;
  color: var(--color-primary);
}

.delivery-radio-card span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.km-calculator-wrapper {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
}

.btn-gps-calc {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background-color: var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-gps-calc:hover {
  background-color: var(--color-accent);
}

.sector-select {
  width: 100%;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  background-color: #ffffff;
  outline: none;
}

.distance-badge-card {
  margin-top: 0.6rem;
  padding: 0.55rem 0.75rem;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #065f46;
}

.cart-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
}

.cart-footer-totals {
  margin-bottom: 1rem;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2rem;
  font-weight: 800;
}

.btn-checkout-whatsapp {
  width: 100%;
  padding: 0.9rem;
  background-color: #25d366;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

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

/* 6. Modal de Detalle de Prenda */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl);
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .modal-grid {
    grid-template-columns: 1fr 1.1fr;
  }
}

.modal-image-col {
  display: flex;
  flex-direction: column;
}

.modal-main-image-wrap {
  position: relative;
  width: 100%;
}

.modal-view-badge {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.modal-image-col img {
  width: 100%;
  height: 100%;
  max-height: 460px;
  object-fit: cover;
  border-top-left-radius: var(--radius-lg);
}

@media (max-width: 767px) {
  .modal-image-col img {
    border-top-right-radius: var(--radius-lg);
  }
}

.modal-gallery-thumbs {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.25rem;
  justify-content: center;
}

.modal-thumb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 65px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  cursor: pointer;
  padding: 2px;
  transition: all 0.2s ease;
}

.modal-thumb-btn img {
  width: 100% !important;
  height: 60px !important;
  max-height: 60px !important;
  object-fit: cover !important;
  border-radius: 6px !important;
}

.modal-thumb-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.2rem 0;
}

.modal-thumb-btn:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.modal-thumb-btn.active {
  border-color: var(--color-primary);
  background: #f1f5f9;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.modal-thumb-btn.active .modal-thumb-label {
  color: var(--color-primary);
}

.modal-gallery-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem 0.5rem;
}

.modal-info-col {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

/* Toast flotante */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background-color: var(--color-primary);
  color: #ffffff;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}
