/* ========================================
RESPONSIVE BASE - MOBILE FIRST
======================================== */
:root {
  --primary: #ff6b6b;
  --secondary: #4ecdc4;
  --dark: #2c2c2c;
  --light: #ffffff;
  --gray: #f5f5f5;
  --shadow: 0 4px 15px rgba(0,0,0,0.1);
  --radius: 12px;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  background: var(--gray);
  color: var(--dark);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ========================================
UTILITIES RESPONSIVE
======================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.flex { display: flex; gap: var(--spacing-md); }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.grid { display: grid; gap: var(--spacing-md); }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* ========================================
HEADER RESPONSIVE
======================================== */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, var(--primary), #ff8e8e);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.logo {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 700;
  white-space: nowrap;
}

/* Mobile Menu */
.mobile-menu-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--spacing-sm);
  display: block;
}

nav ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  flex-direction: column;
  padding: var(--spacing-md);
  box-shadow: var(--shadow);
  gap: var(--spacing-sm);
}

nav ul.active { display: flex; }

nav ul li a {
  color: var(--dark);
  text-decoration: none;
  padding: var(--spacing-sm);
  display: block;
  font-weight: 500;
}

.header-icons { 
  display: flex; 
  gap: var(--spacing-md); 
  align-items: center; 
}

.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  position: relative;
  padding: var(--spacing-sm);
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--secondary);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 50%;
  min-width: 18px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
HERO SECTION RESPONSIVE
======================================== */
.hero {
  background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)),
              url('https://images.unsplash.com/photo-1483985988355-763728e1935b?w=1920') center/cover;
  color: white;
  text-align: center;
  padding: clamp(3rem, 15vw, 6rem) var(--spacing-md);
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero h1 {
  font-size: clamp(1.5rem, 6vw, 3rem);
  margin-bottom: var(--spacing-md);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  line-height: 1.2;
}

.hero p {
  font-size: clamp(0.9rem, 3vw, 1.2rem);
  max-width: 600px;
  margin: 0 auto;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* ========================================
FILTERS & SEARCH RESPONSIVE
======================================== */
.filters-container {
  padding: var(--spacing-md);
  background: white;
  position: sticky;
  top: 70px;
  z-index: 900;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

#search-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  margin-bottom: var(--spacing-sm);
  font-size: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  justify-content: center;
  overflow-x: auto;
  padding-bottom: var(--spacing-sm);
  -webkit-overflow-scrolling: touch;
}

.filters::-webkit-scrollbar { display: none; }

.filter-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all 0.3s;
}

.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: white;
}

/* ========================================
PRODUCTS GRID RESPONSIVE
======================================== */
.section-title {
  text-align: center;
  font-size: clamp(1.5rem, 5vw, 2rem);
  padding: var(--spacing-lg) var(--spacing-md) var(--spacing-md);
  color: var(--dark);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  padding: 0 var(--spacing-md) var(--spacing-lg);
  max-width: 1400px;
  margin: 0 auto;
}

.product-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover { transform: translateY(-5px); }

.product-img-container {
  position: relative;
  height: 300px;
  overflow: hidden;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

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

.tag {
  position: absolute;
  top: var(--spacing-sm);
  left: var(--spacing-sm);
  padding: 4px 10px;
  font-size: 0.7rem;
  color: white;
  border-radius: 15px;
  font-weight: 600;
}

.tag.new { background: var(--primary); }
.tag.sale { background: var(--secondary); }
.tag.best { background: #ffd166; color: var(--dark); }

.product-info {
  padding: var(--spacing-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.product-price {
  font-size: 1.3rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.product-desc {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: var(--spacing-sm);
}

.stock-info {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: var(--spacing-md);
}

/* SELECTOR DE CANTIDAD EN PRODUCTO */
.product-quantity-selector {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  justify-content: center;
  background: var(--gray);
  padding: var(--spacing-sm);
  border-radius: 8px;
}

.product-quantity-selector label {
  font-size: 0.9rem;
  color: var(--dark);
  font-weight: 600;
}

.product-qty-input {
  width: 70px;
  padding: 0.5rem;
  text-align: center;
  border: 2px solid var(--gray);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
}

.product-qty-input:focus {
  outline: none;
  border-color: var(--primary);
}

.add-to-cart, .buy-now {
  width: 100%;
  padding: var(--spacing-md);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  transition: all 0.3s;
}

.add-to-cart { background: var(--primary); color: white; }
.add-to-cart:hover { background: #ff5252; }
.buy-now { background: var(--secondary); color: white; }
.buy-now:hover { background: #3dbdb5; }

/* ========================================
CART SIDEBAR RESPONSIVE - CORREGIDO
======================================== */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  background: white;
  box-shadow: -5px 0 20px rgba(0,0,0,0.15);
  transition: right 0.3s ease;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md);
}

.cart-sidebar.active { right: 0; }

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--gray);
  margin-bottom: var(--spacing-md);
}

.cart-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--dark);
}

.close-cart {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--dark);
  padding: var(--spacing-sm);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--spacing-sm) 0;
}

.cart-item {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--gray);
  align-items: flex-start;
}

.cart-item-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

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

.cart-item-details h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
  font-weight: 600;
  line-height: 1.3;
}

.cart-item-details p {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: var(--spacing-sm) 0;
  flex-wrap: wrap;
}

.quantity-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--gray);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.quantity-btn:hover {
  background: var(--gray);
  border-color: var(--primary);
}

.quantity-input {
  width: 50px;
  padding: 0.3rem;
  text-align: center;
  border: 1px solid var(--gray);
  border-radius: 4px;
  font-size: 0.9rem;
}

.quantity-input:focus {
  outline: none;
  border-color: var(--primary);
}

.remove-item {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  margin-left: auto;
  transition: all 0.2s;
}

.remove-item:hover {
  background: #ff5252;
}

.cart-item-total {
  font-weight: bold;
  color: var(--primary);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.cart-totals {
  border-top: 2px solid var(--gray);
  padding-top: var(--spacing-md);
  margin-top: auto;
}

.cart-total, .cart-shipping, .cart-discount {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  font-size: 0.95rem;
  color: #666;
}

.cart-total-final {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-md) 0;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--primary);
  border-top: 2px solid var(--dark);
  margin-top: var(--spacing-sm);
}

#coupon-input {
  width: 100%;
  padding: var(--spacing-md);
  border: 2px solid var(--gray);
  border-radius: 8px;
  margin: var(--spacing-md) 0;
  font-size: 1rem;
}

#coupon-input:focus {
  outline: none;
  border-color: var(--primary);
}

.apply-coupon-btn, .checkout-btn {
  width: 100%;
  padding: var(--spacing-md);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  transition: all 0.3s;
}

.apply-coupon-btn { background: var(--secondary); color: white; }
.apply-coupon-btn:hover { background: #3dbdb5; }
.checkout-btn { background: var(--primary); color: white; }
.checkout-btn:hover { background: #ff5252; }

/* ========================================
FLOATING BUTTONS RESPONSIVE
======================================== */
.floating-buttons {
  position: fixed;
  bottom: clamp(15px, 3vh, 25px);
  right: clamp(15px, 3vw, 25px);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  z-index: 1500;
}

.floating-btn {
  width: clamp(50px, 12vw, 60px);
  height: clamp(50px, 12vw, 60px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.3s;
  border: none;
}

.floating-btn:hover { transform: scale(1.1); }
.whatsapp { background: #25D366; }
.call { background: var(--primary); }

/* ========================================
MODAL RESPONSIVE
======================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.modal-content {
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius);
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 {
  font-size: 1.3rem;
  margin-bottom: var(--spacing-md);
}

.modal-content p {
  color: #666;
  margin-bottom: var(--spacing-lg);
}

.btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

/* ========================================
CONTACT SECTION RESPONSIVE
======================================== */
#contacto {
  padding: var(--spacing-lg) var(--spacing-md);
  background: white;
}

.contact-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
  max-width: 1200px;
  margin: 0 auto;
}

.contact-info ul { list-style: none; }

.contact-info li {
  padding: var(--spacing-sm) 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.95rem;
}

.contact-info i {
  color: var(--primary);
  width: 20px;
}

.map-container {
  margin-top: var(--spacing-md);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.request-form input, .request-form textarea {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--gray);
  border-radius: 8px;
  margin-bottom: var(--spacing-sm);
  font-size: 1rem;
}

.request-form button {
  width: 100%;
  padding: var(--spacing-md);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

/* ========================================
FOOTER RESPONSIVE
======================================== */
footer {
  background: var(--dark);
  color: white;
  padding: var(--spacing-lg) var(--spacing-md);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-section h3 {
  margin-bottom: var(--spacing-sm);
  font-size: 1.2rem;
}

.footer-section p {
  color: #ccc;
  font-size: 0.95rem;
}

.copyright {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid #555;
  font-size: 0.85rem;
  color: #999;
}

/* ========================================
PWA INSTALL PROMPT RESPONSIVE
======================================== */
#install-prompt {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: var(--spacing-md);
  box-shadow: 0 -2px 20px rgba(0,0,0,0.15);
  z-index: 4000;
  text-align: center;
}

#install-prompt p {
  margin-bottom: var(--spacing-sm);
  font-size: 0.95rem;
}

#install-prompt button {
  margin: 0 var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.install-btn { background: var(--primary); color: white; }
.cancel-install { background: var(--gray); color: var(--dark); }

/* ========================================
LOADING & UTILS
======================================== */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-lg);
  grid-column: 1 / -1;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ========================================
TABLET BREAKPOINT (768px+)
======================================== */
@media (min-width: 768px) {
  .mobile-menu-btn { display: none; }
  
  nav ul {
    display: flex !important;
    position: static;
    flex-direction: row;
    background: transparent;
    padding: 0;
    box-shadow: none;
    gap: var(--spacing-lg);
  }
  
  nav ul li a {
    color: white;
    padding: 0;
    font-size: 1rem;
  }
  
  .hero {
    min-height: 70vh;
    padding: 6rem 2rem;
  }
  
  .hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
  }
  
  .hero p {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    padding: 0 2rem var(--spacing-lg);
  }
  
  .product-title { font-size: 1.1rem; }
  .product-price { font-size: 1.3rem; }
  
  .contact-container { grid-template-columns: 1fr 1fr; }
  
  .cart-sidebar { width: 450px; }
}

/* ========================================
DESKTOP BREAKPOINT (1024px+)
======================================== */
@media (min-width: 1024px) {
  .container { padding: 0 2rem; }
  
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    padding: 0 3rem var(--spacing-lg);
  }
  
  footer .footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    text-align: left;
  }
}

/* ========================================
LARGE DESKTOP (1440px+)
======================================== */
@media (min-width: 1440px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
    max-width: 1600px;
  }
}

/* ========================================
MOBILE CART OPTIMIZATIONS
======================================== */
@media (max-width: 480px) {
  .cart-sidebar {
    max-width: 100%;
  }
  
  .cart-item {
    flex-direction: column;
  }
  
  .cart-item-img {
    width: 100%;
    height: 150px;
  }
  
  .cart-item-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .remove-item {
    margin-left: 0;
    margin-top: var(--spacing-sm);
  }
}