:root {
  --bg: #0f172a;
  --card: #111827;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent-2: #f59e0b;
  --radius: 16px;
  --shadow: 0 15px 40px rgba(0, 0, 0, 0.28);
  --gradient-1: rgba(20, 184, 166, 0.12);
  --gradient-2: rgba(245, 158, 11, 0.12);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
  --gradient-1: rgba(20, 184, 166, 0.1);
  --gradient-2: rgba(245, 158, 11, 0.1);
}

* { box-sizing: border-box; }

/* Mejoras táctiles para móvil */
html {
  -webkit-tap-highlight-color: rgba(20, 184, 166, 0.3);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, var(--gradient-1), transparent 40%),
              radial-gradient(circle at 80% 0%, var(--gradient-2), transparent 35%),
              var(--bg);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  overscroll-behavior-y: none;
}

main {
  width: min(1200px, 100%);
  margin: 0 auto 72px;
}

img { max-width: 100%; display: block; }

.section { padding: 64px clamp(16px, 4vw, 48px); }

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: center;
  gap: 32px;
  padding: clamp(32px, 6vw, 72px);
  width: min(1200px, 100%);
  margin: 0 auto;
}

.hero__content h1 { font-size: clamp(32px, 6vw, 56px); margin: 12px 0; letter-spacing: -0.02em; }
.hero__content .lead { color: var(--muted); max-width: 520px; }

.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(20, 184, 166, 0.15); color: #14b8a6; font-weight: 600; font-size: 13px; border: 1px solid rgba(20, 184, 166, 0.2); }

[data-theme="light"] .badge {
  background: rgba(20, 184, 166, 0.1);
  color: #0d9488;
  border-color: rgba(20, 184, 166, 0.3);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.button {
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1021;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.2s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px; /* Mínimo para touch targets */
  touch-action: manipulation; /* Previene zoom doble tap */
}
.button--ghost { background: transparent; color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: none; }

[data-theme="light"] .button--ghost {
  border-color: rgba(100, 116, 139, 0.3);
}
.button:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 18px 46px rgba(0, 0, 0, 0.35); }

.hero__visual {
  height: 320px;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(20, 184, 166, 0.35), rgba(245, 158, 11, 0.35)),
              radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.04), transparent 55%),
              rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero__visual::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.section__header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section__header h2 { margin: 0; }
.controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.search { position: relative; flex: 1; min-width: 200px; }
.search input { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 12px 38px 12px 12px; color: var(--ink); width: 100%; }

[data-theme="light"] .search input {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(100, 116, 139, 0.2);
}

[data-theme="light"] .search input::placeholder {
  color: var(--muted);
}
.search .shortcut { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.08); padding: 4px 6px; border-radius: 8px; font-size: 12px; color: var(--muted); pointer-events: none; }

.sugerencias {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: transparent;
  border: none;
  border-radius: 12px;
  box-shadow: none;
  z-index: 100;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  display: none;
  transition: max-height 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.sugerencias--visible {
  display: block;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 300px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  opacity: 1;
  visibility: visible;
}

.sugerencia-item {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sugerencia-item:last-child {
  border-bottom: none;
}

.sugerencia-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sugerencia-nombre {
  font-weight: 500;
}

.sugerencia-precio {
  color: #fcd34d;
  font-size: 14px;
  font-weight: 600;
}

#orden { background: rgba(255, 255, 255, 0.05); color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 12px; min-width: 180px; flex: 1; }

[data-theme="light"] #orden {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(100, 116, 139, 0.2);
}

.categorias {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.categoria-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.categoria-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.categoria-chip--active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #0b1021;
}

.favoritos-toggle {
  margin-bottom: 16px;
}

.btn-favoritos {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-favoritos:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.btn-favoritos--active {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-favoritos .fav-icon {
  font-size: 18px;
  transition: color 0.2s ease;
}

.btn-favoritos--active .fav-icon {
  color: #ef4444;
}

.fav-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  min-width: 20px;
  text-align: center;
}

.products__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .card {
  border-color: rgba(100, 116, 139, 0.15);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% -10%, rgba(255, 255, 255, 0.06), transparent 40%);
  pointer-events: none;
}

[data-theme="light"] .card::after {
  background: radial-gradient(circle at 20% -10%, rgba(20, 184, 166, 0.03), transparent 40%);
}

.card:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4); }

.card__fav {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--card);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  font-size: 18px;
}

.card__fav:hover {
  transform: scale(1.1);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.card__fav--active {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.card__fav--active:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(1.1);
}

.card__thumb {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(245, 158, 11, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b1021;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.card__placeholder { display: grid; place-items: center; width: 100%; height: 100%; }

.card__title { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.card__desc { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.4; }

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card__price-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.card__add-cart {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.card__add-cart:hover {
  transform: scale(1.1);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.card__add-cart:active {
  transform: scale(0.95);
}

.price { font-weight: 700; color: #fcd34d; font-size: 16px; }

[data-theme="light"] .price {
  color: #d97706;
}
.tag { font-size: 12px; padding: 4px 8px; border-radius: 999px; background: rgba(20, 184, 166, 0.12); color: #67e8f9; }

[data-theme="light"] .tag {
  background: rgba(20, 184, 166, 0.15);
  color: #0d9488;
  border: 1px solid rgba(20, 184, 166, 0.3);
}

.contact { display: grid; place-items: center; }
.contact__card { background: linear-gradient(145deg, rgba(20, 184, 166, 0.15), rgba(245, 158, 11, 0.12)); border-radius: 20px; padding: 28px; border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: var(--shadow); max-width: 960px; width: 100%; display: grid; gap: 12px; }
.contact__actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.contact__link { display: inline-flex; align-items: center; justify-content: center; padding: 12px; border-radius: 12px; text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.05); font-weight: 600; transition: transform 0.15s ease, background 0.2s ease; }
.contact__link:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.12); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal--active {
  opacity: 1;
  pointer-events: all;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal__content {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 16px;
  transform: scale(0.9);
  transition: transform 0.25s ease;
}

[data-theme="light"] .modal__content {
  border-color: rgba(100, 116, 139, 0.2);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
}

.modal--active .modal__content {
  transform: scale(1);
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--ink);
  font-size: 28px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  transition: background 0.2s ease, transform 0.15s ease;
  z-index: 1;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.modal__favorito {
  position: absolute;
  top: 16px;
  right: 60px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  z-index: 1;
}

.modal__favorito:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
}

.modal__favorito--active {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

.modal__favorito--active:hover {
  background: rgba(239, 68, 68, 0.3);
}

.modal__thumb {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(245, 158, 11, 0.2));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.modal__placeholder {
  font-size: 48px;
  font-weight: 700;
  color: #0b1021;
}

.modal__titulo {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.modal__descripcion {
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.modal__share {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.share-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.share-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.share-btn svg {
  width: 20px;
  height: 20px;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.modal__precio {
  font-weight: 700;
  color: #fcd34d;
  font-size: 24px;
}

[data-theme="light"] .modal__precio {
  color: #d97706;
}

@media (max-width: 720px) {
  .modal__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .modal__footer .button {
    width: 100%;
    text-align: center;
  }
}

/* ========== MODAL DE CONFIRMACIÓN ========== */
.confirm-modal {
  max-width: 420px;
  text-align: center;
}

.confirm-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.2));
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ef4444;
  animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.confirm-title {
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.confirm-description {
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.6;
  font-size: 15px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.confirm-actions .button {
  flex: 1;
  min-width: 140px;
  justify-content: center;
}

.button--danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}

.button--danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 20px 50px rgba(239, 68, 68, 0.3);
}

@media (max-width: 480px) {
  .confirm-modal {
    padding: 20px;
  }

  .confirm-icon {
    width: 64px;
    height: 64px;
  }

  .confirm-icon svg {
    width: 48px;
    height: 48px;
  }

  .confirm-title {
    font-size: 20px;
  }

  .confirm-description {
    font-size: 14px;
  }

  .confirm-actions {
    flex-direction: column;
  }

  .confirm-actions .button {
    width: 100%;
  }
}

/* ========== RESPONSIVE MOBILE MEJORADO ========== */
@media (max-width: 768px) {
  /* Espaciado general más compacto */
  .section { padding: 32px 16px; }
  .hero {
    padding: 24px 16px;
    min-height: auto;
  }

  .hero h1 {
    font-size: 36px;
    line-height: 1.1;
    margin-bottom: 12px;
  }

  .hero p {
    font-size: 16px;
    max-width: 100%;
  }

  .hero__visual {
    height: 200px;
    margin-top: 20px;
  }

  .hero__actions {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .hero__actions .button {
    width: 100%;
    justify-content: center;
  }

  /* Controles de búsqueda y orden en columna */
  .controls {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }

  .search {
    width: 100%;
    flex: none;
  }

  #orden {
    width: 100%;
    flex: none;
  }

  /* Categorías con scroll horizontal */
  .categories {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .categories::-webkit-scrollbar {
    height: 4px;
  }

  .categories::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
  }

  .categories::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 2px;
  }

  .chip {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Header de sección más compacto */
  .section__header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .btn-favoritos {
    width: 100%;
    justify-content: center;
  }

  /* Grid de productos más grande en móvil */
  .products__grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  /* Tarjetas más compactas */
  .card {
    padding: 12px;
    gap: 8px;
  }

  .card__nombre {
    font-size: 16px;
  }

  .card__precio {
    font-size: 18px;
  }

  .card__etiqueta {
    font-size: 10px;
    padding: 4px 8px;
  }

  /* Modal optimizado para móvil */
  .modal__content {
    width: calc(100vw - 24px);
    max-width: 100%;
    max-height: 90vh;
    margin: 20px 12px;
    padding: 16px;
    overflow-y: auto;
  }

  .modal__close,
  .modal__favorito {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .modal__favorito {
    right: 52px;
  }

  .modal__title {
    font-size: 24px;
    margin: 50px 0 12px;
  }

  .modal__description {
    font-size: 15px;
    line-height: 1.6;
  }

  .modal__price {
    font-size: 28px;
  }

  /* Botones del modal más grandes (mejor touch) */
  .modal__actions {
    flex-direction: column;
    gap: 12px;
  }

  .modal__actions .button {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 16px;
  }

  /* Compartir en fila */
  .modal__share {
    display: flex;
    gap: 10px;
  }

  .share-btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
  }

  /* Botón de tema más pequeño en móvil */
  .theme-toggle {
    width: 44px;
    height: 44px;
    top: 16px;
    right: 16px;
  }

  .theme-icon {
    width: 20px;
    height: 20px;
  }

  .theme-icon::before {
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
  }

  .theme-icon::after {
    width: 20px;
    height: 20px;
  }

  /* Botón de carrito más accesible */
  .cart-toggle {
    width: 44px;
    height: 44px;
    top: 70px;
    right: 16px;
    font-size: 20px;
  }

  /* Panel de carrito a pantalla completa en móvil */
  .cart-panel {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
  }

  .cart-panel--active {
    right: 0 !important;
  }

  /* Contacto en columna */
  #contacto .section-content {
    flex-direction: column;
    gap: 24px;
  }

  .contact-social {
    justify-content: center;
  }
}

/* Móviles pequeños */
@media (max-width: 400px) {
  .hero h1 {
    font-size: 28px;
  }

  .products__grid {
    grid-template-columns: 1fr;
  }

  .card {
    max-width: 100%;
  }

  .modal__content {
    margin: 12px 8px;
    padding: 12px;
  }

  .modal__title {
    font-size: 20px;
    margin-top: 46px;
  }

  .share-btn {
    font-size: 12px;
    padding: 10px;
  }
}

/* ========== TEMA TOGGLE ========== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid rgba(100, 116, 139, 0.2);
  color: var(--ink);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: var(--shadow);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.theme-icon {
  width: 24px;
  height: 24px;
  position: relative;
  transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-toggle:hover .theme-icon {
  transform: rotate(360deg);
}

/* Sol (tema oscuro - muestra sol) */
.theme-icon::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.6),
              0 0 30px rgba(251, 191, 36, 0.3);
  transition: all 0.4s ease;
}

/* Rayos del sol */
.theme-icon::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  top: 0;
  left: 0;
  border-radius: 50%;
  background:
    linear-gradient(0deg, transparent 40%, #fbbf24 40%, #fbbf24 60%, transparent 60%),
    linear-gradient(90deg, transparent 40%, #fbbf24 40%, #fbbf24 60%, transparent 60%),
    linear-gradient(45deg, transparent 42%, #fbbf24 42%, #fbbf24 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, #fbbf24 42%, #fbbf24 58%, transparent 58%);
  opacity: 0.8;
  animation: rotate-rays 20s linear infinite;
}

@keyframes rotate-rays {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Luna (tema claro - muestra luna) */
[data-theme="light"] .theme-icon::before {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.6),
              0 0 30px rgba(99, 102, 241, 0.3);
  border-radius: 50%;
  position: relative;
}

[data-theme="light"] .theme-icon::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: 1px;
  left: 7px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: inset -2px -2px 4px rgba(99, 102, 241, 0.3);
  animation: none;
}

/* Estrellas alrededor de la luna */
[data-theme="light"] .theme-toggle::before,
[data-theme="light"] .theme-toggle::after {
  content: '✦';
  position: absolute;
  color: #fbbf24;
  font-size: 8px;
  animation: twinkle 2s ease-in-out infinite;
}

[data-theme="light"] .theme-toggle::before {
  top: 8px;
  right: 8px;
  animation-delay: 0s;
}

[data-theme="light"] .theme-toggle::after {
  bottom: 10px;
  left: 10px;
  animation-delay: 1s;
}

@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* ========== CARRITO ========== */
.cart-toggle {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.cart-toggle:hover {
  transform: scale(1.1);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 2px;
}

.cart-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: var(--card);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

[data-theme="light"] .cart-panel {
  border-left-color: rgba(100, 116, 139, 0.2);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
}

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

.cart-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h3 {
  margin: 0;
  font-size: 20px;
}

.cart-close {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 32px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.cart-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.cart-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.cart-item__img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(245, 158, 11, 0.2));
}

.cart-item__info {
  flex: 1;
}

.cart-item__name {
  font-weight: 600;
  margin: 0 0 4px;
  font-size: 14px;
}

.cart-item__price {
  color: #fcd34d;
  font-weight: 600;
  font-size: 14px;
}

[data-theme="light"] .cart-item__price {
  color: #d97706;
}

.cart-item__remove {
  background: rgba(239, 68, 68, 0.15);
  border: none;
  color: #ef4444;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 18px;
}

.cart-item__remove:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(1.1);
}

.cart-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 18px;
}

.cart-total-price {
  color: #fcd34d;
}

[data-theme="light"] .cart-total-price {
  color: #d97706;
}

.button--full {
  width: 100%;
  text-align: center;
  justify-content: center;
}

.button--cart {
  background: transparent;
  border: 2px solid;
  border-image: linear-gradient(135deg, var(--accent), var(--accent-2)) 1;
  color: var(--ink);
}

.cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

/* ========== ANIMACIONES SCROLL ========== */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 500px) {
  .cart-panel {
    width: 100vw;
    right: -100vw;
  }
}

/* ========== LOADING SKELETON ========== */
.skeleton-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.skeleton-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

.skeleton-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.skeleton-title {
  height: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  width: 70%;
}

.skeleton-desc {
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  width: 100%;
}

.skeleton-price {
  height: 18px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  width: 40%;
  margin-top: auto;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  pointer-events: all;
  animation: toast-slide-in 0.3s ease-out;
  transform-origin: right;
}

.toast--success {
  border-left: 4px solid #10b981;
}

.toast--error {
  border-left: 4px solid #ef4444;
}

.toast--info {
  border-left: 4px solid #3b82f6;
}

.toast--warning {
  border-left: 4px solid #f59e0b;
}

.toast.toast--removing {
  animation: toast-slide-out 0.3s ease-out forwards;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.8);
  }
}

.toast__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.toast--success .toast__icon {
  color: #10b981;
}

.toast--error .toast__icon {
  color: #ef4444;
}

.toast--info .toast__icon {
  color: #3b82f6;
}

.toast--warning .toast__icon {
  color: #f59e0b;
}

.toast__content {
  flex: 1;
}

.toast__title {
  font-weight: 600;
  margin: 0 0 4px;
  font-size: 14px;
}

.toast__message {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.toast__close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

@media (max-width: 768px) {
  .toast-container {
    top: 80px;
    right: 12px;
    left: 12px;
    max-width: none;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }
}

/* ========== SCROLL TO TOP BUTTON ========== */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1021;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-to-top--visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.scroll-to-top:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 25px rgba(20, 184, 166, 0.4);
}

.scroll-to-top:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

/* ========== ANIMACIÓN AGREGAR AL CARRITO ========== */
@keyframes fly-to-cart {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(var(--tx), var(--ty)) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0.2);
  }
}

.card__thumb.adding-to-cart::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(20, 184, 166, 0.3);
  border-radius: 12px;
  animation: cart-flash 0.6s ease;
}

@keyframes cart-flash {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.cart-toggle.cart-bounce {
  animation: cart-bounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes cart-bounce {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.2) rotate(-5deg); }
  50% { transform: scale(0.9) rotate(5deg); }
  75% { transform: scale(1.15) rotate(-3deg); }
}

/* Lazy loading placeholder */
img[data-src] {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(245, 158, 11, 0.1));
  min-height: 100px;
}

img.lazy-loading {
  opacity: 0.5;
  filter: blur(5px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

img.lazy-loaded {
  opacity: 1;
  filter: blur(0);
}
