:root {
  --bg: oklch(99% 0.002 240);
  --surface: oklch(100% 0 0);
  --fg: oklch(18% 0.012 250);
  --muted: oklch(54% 0.012 250);
  --border: oklch(92% 0.005 250);
  --accent: oklch(58% 0.18 255);
  --accent-soft: oklch(96% 0.02 255);
  --danger: oklch(60% 0.15 25);
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 12px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--bg); color: var(--fg); font-family: var(--font-body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 12px 0; }
.nav-wrapper { display: flex; justify-content: space-between; align-items: center; }
.logo-area { display: flex; align-items: center; gap: 12px; }
.logo-img { height: 50px; width: auto; border-radius: 4px; object-fit: contain; }
.logo-text { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; letter-spacing: -0.03em; }
.cart-trigger { background: var(--fg); color: white; border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 8px; transition: opacity 0.2s; }
.cart-count { background: var(--accent); color: white; font-size: 0.75rem; padding: 2px 6px; border-radius: 10px; }

.hero { padding: 60px 0; text-align: center; background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); margin-bottom: 40px; }
.hero-content { max-width: 700px; margin: 0 auto; }
.hero h1 { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.2; margin-bottom: 20px; letter-spacing: -0.03em; font-weight: 800; }
.hero p { font-size: 1.1rem; color: var(--muted); margin-bottom: 30px; }
.hero-badge { display: inline-block; padding: 6px 16px; background: var(--accent-soft); color: var(--accent); border-radius: 20px; font-size: 0.8rem; font-weight: 700; margin-bottom: 20px; text-transform: uppercase; letter-spacing: 0.05em; }

.controls { margin-bottom: 30px; display: flex; flex-direction: column; gap: 20px; }
.search-bar { width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; outline: none; transition: border-color 0.2s; box-shadow: var(--shadow); }
.search-bar:focus { border-color: var(--accent); }
.filter-group { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.filter-chip { background: var(--surface); border: 1px solid var(--border); padding: 8px 20px; border-radius: 20px; cursor: pointer; white-space: nowrap; font-size: 0.9rem; transition: all 0.2s; }
.filter-chip.active { background: var(--accent); color: white; border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px; margin-bottom: 80px; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; }
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.product-img { width: 100%; aspect-ratio: 1/1; background: #f8f8f8; border-radius: 4px; margin-bottom: 20px; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 3rem; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-cat { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; font-weight: 600; margin-bottom: 8px; }
.product-info h3 { font-size: 1.2rem; margin-bottom: 16px; font-weight: 700; }
.price-tiers { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 24px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.price-tiers th, .price-tiers td { padding: 10px; text-align: center; border-bottom: 1px solid var(--border); }
.price-tiers th { background: var(--bg); color: var(--muted); font-weight: 600; }
.price-highlight { background: var(--accent-soft); font-weight: 700; color: var(--accent); }

.service-box { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 15px; margin-bottom: 20px; font-size: 0.85rem; }
.service-box h4 { color: var(--accent); margin-bottom: 8px; font-size: 0.95rem; }
.service-box p { margin: 0; padding-bottom: 10px; color: var(--fg); }
.price-label { font-weight: 800; font-size: 1.1rem; color: var(--fg); display: block; text-align: center; margin-top: 10px; }

.card-qty-selector { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 12px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
.card-qty-label { font-size: 0.85rem; font-weight: 600; flex: 1; }
.qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: white; border-radius: 6px; cursor: pointer; font-weight: 700; transition: all 0.2s; }
.qty-input { width: 45px; text-align: center; border: 1px solid var(--border); background: white; border-radius: 4px; font-weight: 700; height: 32px; }

.add-btn { width: 100%; background: var(--surface); border: 2px solid var(--fg); padding: 14px; border-radius: var(--radius); cursor: pointer; font-weight: 700; transition: all 0.2s; font-size: 1rem; }
.add-btn:hover { background: var(--fg); color: white; }
.add-btn:disabled { border-color: var(--border); color: var(--muted); cursor: not-allowed; }
.stock-warning { font-size: 0.75rem; color: var(--danger); text-align: center; margin-bottom: 10px; font-weight: 600; display: none; }

.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: all 0.3s; z-index: 1000; }
.drawer-overlay.open { opacity: 1; visibility: visible; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 100%; max-width: 420px; background: var(--surface); box-shadow: -10px 0 30px rgba(0,0,0,0.1); transform: translateX(100%); transition: transform 0.3s ease; display: flex; flex-direction: column; z-index: 1001; }
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.close-drawer { background: none; border: none; font-size: 1.8rem; cursor: pointer; }
.cart-items { flex: 1; overflow-y: auto; padding: 24px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.item-details h4 { font-size: 0.95rem; font-weight: 600; margin:0; }
.item-details p { font-size: 0.85rem; color: var(--muted); margin:0; }
.item-qty-controls { display: flex; align-items: center; gap: 12px; }
.cart-qty-input { width: 50px; text-align: center; border: 1px solid var(--border); background: white; border-radius: 4px; font-weight: 700; height: 32px; }
.shipping-section { margin-top: 20px; padding: 16px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
.shipping-option { display: flex; align-items: center; gap: 12px; padding: 10px; cursor: pointer; border: 1px solid transparent; border-radius: 6px; transition: all 0.2s; margin-bottom: 8px; font-size: 0.9rem; }
.shipping-option:hover { background: var(--accent-soft); }
.shipping-option.active { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.shipping-option input { accent-color: var(--accent); }

.drawer-footer { padding: 24px; border-top: 1px solid var(--border); background: var(--bg); }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
.summary-total { font-weight: 700; font-size: 1.3rem; margin: 16px 0; border-top: 1px solid var(--border); padding-top: 16px; }
.whatsapp-btn { width: 100%; background: #25D366; color: white; border: none; padding: 18px; border-radius: var(--radius); font-weight: 700; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px; box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3); }

/* ADMIN PANEL */
.admin-panel { position: fixed; inset: 0; background: var(--bg); z-index: 2000; display: none; overflow-y: auto; padding: 40px 20px; }
.admin-content { max-width: 1100px; margin: 0 auto; background: var(--surface); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; border-bottom: 2px solid var(--bg); padding-bottom: 20px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-input { width: 70px; padding: 5px; border: 1px solid var(--border); border-radius: 4px; text-align: center; }
.admin-input-text { width: 100%; padding: 5px; border: 1px solid var(--border); border-radius: 4px; }
.save-btn { background: var(--accent); color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-weight: 600; }
.del-btn { background: var(--danger); color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-weight: 600; margin-left: 5px; }
.add-product-form { background: var(--bg); padding: 20px; border-radius: var(--radius); margin-bottom: 40px; border: 1px solid var(--border); display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.8rem; font-weight: 700; color: var(--muted); }

#admin-auth-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(10px); display: none; z-index: 3000; place-items: center; }
.auth-card { background: var(--surface); padding: 30px; border-radius: var(--radius); width: 90%; max-width: 400px; box-shadow: var(--shadow); border: 1px solid var(--border); text-align: center; }

@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } .drawer { max-width: 100%; } .admin-table { display: block; overflow-x: auto; } }

/* Estado Sin Stock */
.product-card.out-of-stock {
  opacity: 0.6;
  filter: grayscale(0.4);
  pointer-events: none; /* Desactiva clics en toda la tarjeta */
  cursor: not-allowed;
}

.out-of-stock-badge {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
}

/* Ajuste para que la tarjeta sea relativa y el badge se posicione bien */
.product-card {
  position: relative;
}

.item-details {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.item-details div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Mejora estética del Selector de Envío */
.shipping-select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
  background-color: var(--bg); /* Fondo suave */
  color: var(--fg);
  cursor: pointer;
  appearance: none; /* Quita el estilo por defecto del navegador */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.shipping-select:focus {
  border-color: var(--accent);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Espaciado del contenedor para que no quede pegado abajo */
.shipping-section {
  margin-top: 25px;
  margin-bottom: 30px; /* Espacio extra antes del total */
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Botón Flotante de WhatsApp */
.whatsapp-float {
  position: fixed;
  width: 60px;
  height: 60px;
  bottom: 40px;
  right: 40px;
  background-color: #25d366;
  color: #fff;
  border-radius: 50px;
  text-align: center;
  font-size: 30px;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  background-color: #1ebe5d;
}

/* OCULTAR botón cuando el carrito esté abierto */
.drawer.open ~ .whatsapp-float, 
body:has(.drawer.open) .whatsapp-float {
  display: none !important;
}