@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.35);
  --accent: #f59e0b;
  --whatsapp: #25d366;
  --instagram: #e1306c;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0f172a 50%, #020617 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: rgba(226, 232, 240, 0.8);
  --shadow-smooth: 0 10px 30px -10px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 20px 40px -15px rgba(37, 99, 235, 0.3);
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
  background: #f8fafc;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* BARRA SUPERIOR DE ANUNCIO */
.top-bar {
  background: #0f172a;
  color: #e2e8f0;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar strong {
  color: #3b82f6;
  font-weight: 700;
}

/* NAVBAR MODERNA */
.navbar {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.navbar-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(255,255,255,0.2));
  transition: var(--transition);
}

.brand-title {
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
}

.brand-title span {
  color: var(--accent);
}

/* BUSCADOR ANIMADO CON ICONO */
.search-box {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  padding: 4px 16px;
  transition: var(--transition);
}

.search-box:focus-within {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-box:focus-within .search-icon,
.search-box:focus-within input {
  color: var(--text-main);
}

.search-icon {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.95rem;
  margin-right: 10px;
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 0.9rem;
  outline: none;
  color: #fff;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* BOTONES SOCIALES */
.nav-social-group {
  display: flex;
  gap: 10px;
}

.nav-social-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: var(--transition);
}

.nav-social-btn:hover {
  transform: translateY(-2px);
}

.nav-social-btn.instagram:hover {
  background: var(--instagram);
  border-color: var(--instagram);
  box-shadow: 0 4px 15px rgba(225, 48, 108, 0.4);
}

.nav-social-btn.whatsapp:hover {
  background: var(--whatsapp);
  border-color: var(--whatsapp);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

/* LAYOUT PRINCIPAL */
.container {
  max-width: 1280px;
  width: 100%;
  margin: 24px auto;
  padding: 0 20px;
  display: flex;
  gap: 28px;
  flex: 1;
}

main {
  flex: 1;
}

/* BANNER CARRUSEL */
.banner-carousel {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  background: #090d16;
  margin-bottom: 24px;
}

.banner-viewport {
  width: 100%;
  height: 100%;
}

.banner-track {
  display: flex;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.banner-slide {
  min-width: 100%;
  height: 100%;
}

.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: var(--transition);
}

.banner-btn:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.1);
}

.banner-btn.prev { left: 16px; }
.banner-btn.next { right: 16px; }

/* TRUST FEATURES */
.trust-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.feature-card {
  background: #fff;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-smooth);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.feature-card i {
  font-size: 1.5rem;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 12px;
  border-radius: 12px;
}

.feature-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.feature-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* CATALOG HEADER */
.catalog-header {
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

/* GRILLA DE PRODUCTOS */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}

/* TARJETA DE PRODUCTO */
.card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-smooth);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  animation: cardFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(37, 99, 235, 0.4);
}

.card-img-wrapper {
  width: 100%;
  height: 200px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  position: relative;
}

.card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.card:hover img {
  transform: scale(1.08);
}

.card-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-content h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
  line-height: 1.3;
}

.precio {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.stock {
  font-size: 0.75rem;
  font-weight: 600;
  color: #10b981;
  margin-bottom: 12px;
}

.stock.sin-stock {
  color: #ef4444;
}

.color-selector-wrapper {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.select-color {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  margin-top: auto;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
}

/* CARRITO BOX FLOTANTE */
.carrito-box {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  width: 360px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px) scale(0.95);
  transition: var(--transition);
}

.carrito-box.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.carrito-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.carrito-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carrito-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
}

.btn-toggle-carrito {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-toggle-carrito:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* LISTA CON SCROLL INTERNO */
.items-carrito-container {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 6px;
  margin-top: 8px;
  transition: var(--transition);
}

/* Estilo para barra de scroll elegante */
.items-carrito-container::-webkit-scrollbar {
  width: 5px;
}
.items-carrito-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}
.items-carrito-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

/* CLASE PARA MINIMIZAR CARRITO */
.carrito-box.plegado .items-carrito-container,
.carrito-box.plegado .total-box,
.carrito-box.plegado .btn-continuar {
  display: none !important;
}

.carrito-box.plegado .btn-toggle-carrito {
  transform: rotate(180deg);
}

.badge-count {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.item-carrito {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.88rem;
}

.item-carrito button {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
}

.total-box {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--text-main);
}

.btn-continuar {
  width: 100%;
  margin-top: 12px;
}

/* FOOTER */
.footer {
  background: #0f172a;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 24px;
  margin-top: auto;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* SPINNER CARGANDO */
.loading-spinner {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* RESPONSIVE PANTALLAS MEDIANAS */
@media (max-width: 850px) {
  .container { flex-direction: column; }
  .search-box { order: 3; max-width: 100%; margin-top: 10px; }
  .navbar-content { flex-wrap: wrap; }
}

/* ADAPTACIÓN EXCLUSIVA PARA CELULARES */
@media (max-width: 600px) {
  .top-bar {
    font-size: 0.78rem;
    padding: 6px 10px;
  }

  .container {
    padding: 0 12px;
  }

  /* Ajuste de Navbar en Celulares */
  .navbar-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
  }

  .brand-logo {
    height: 38px;
  }

  .brand-title {
    font-size: 1.1rem;
  }

  .search-box {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
  }

  /* Muestra los botones sociales como círculos compactos */
  .nav-social-group {
    display: flex;
    gap: 8px;
  }

  .nav-social-btn {
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    justify-content: center;
  }

  /* Oculta el texto "Instagram" y "WhatsApp", deja solo el icono */
  .nav-social-btn span {
    display: none;
  }

  .nav-social-btn i {
    font-size: 1.1rem;
  }

  .banner-carousel {
    height: 180px;
  }

  .productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .card-content {
    padding: 12px;
  }

  .card-img-wrapper {
    height: 140px;
  }

  .carrito-box {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 20px 20px 0 0;
    padding: 16px 20px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
  }

  .items-carrito-container {
    max-height: 35vh; /* Ocupa máximo el 35% de la pantalla del celular */
  }
}