:root {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: #0b1020;
  color: #e2e8f0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(124,58,237,0.08), transparent 25%),
              radial-gradient(circle at 80% 10%, rgba(6,182,212,0.08), transparent 25%),
              #0b1020;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.4rem;
  background: rgba(12,17,30,0.9);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.4px;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
}
.class-list {
  display: grid;
  gap: 1.4rem;
}

.nav-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.icon-btn, button {
  cursor: pointer;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  background: #111827;
  color: #e2e8f0;
  transition: transform 0.05s ease, background 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  background: #162138;
}

button:active {
  transform: scale(0.99);
}

.primary {
  background: linear-gradient(90deg, #7c3aed, #06b6d4);
  color: #fff;
  box-shadow: 0 10px 30px rgba(6,182,212,0.18);
}

.primary:hover {
  box-shadow: 0 14px 34px rgba(6,182,212,0.25);
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
}

.secondary {
  background: #111827;
  border: 1px solid rgba(255,255,255,0.08);
}

.hidden { display: none !important; }

.icon-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
  color: #e2e8f0;
}

.badge {
  background: #f97316;
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  margin-left: 0.35rem;
}

.hero {
  padding: 2.5rem 1.5rem 1rem;
}

.eyebrow {
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  margin: 0 0 0.35rem;
}

.hero h1 {
  margin: 0;
  font-size: 2.3rem;
}

.hero p {
  max-width: 640px;
  color: #cbd5e1;
}

.hero-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
}

.content {
  padding: 0 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

section {
  background: #0f172a;
  border: 1px solid #162138;
  border-radius: 14px;
  padding: 1.2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.titulo-barra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.class-nav {
  position: sticky;
  top: 64px;
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0.6rem 0 0.2rem;
  margin-top: 0.4rem;
  background: #0f172a;
}

.class-nav button {
  white-space: nowrap;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #0b1220;
  font-size: 0.9rem;
}

.class-nav button.active {
  background: linear-gradient(90deg, #7c3aed, #06b6d4);
  color: #fff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 260px));
  gap: 1.2rem;
  margin-top: 1rem;
  width: 100%;
  justify-content: center;
  justify-items: stretch;
}

.class-section {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.card {
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 1rem;
  background: #0d1425;
  display: grid;
  gap: 0.6rem;
  box-shadow: 0 12px 26px rgba(0,0,0,0.25);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 420px 640px;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.32);
}

.card .card-top {
  display: grid;
  gap: 0.6rem;
}

.card .card-img {
  width: 100%;
  border-radius: 12px;
}

.card .card-desc {
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0;
}

.card-desc .desc-toggle {
  margin-left: 0.35rem;
  padding: 0.15rem 0.4rem;
  font-size: 0.82rem;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  border: 1px solid rgba(148,163,184,0.25);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #1f2937;
}

.pill.sativa { color: #22d3ee; }
.pill.indica { color: #a78bfa; }
.pill.hibrida { color: #fbbf24; }

.precio {
  font-size: 1.1rem;
  font-weight: 700;
}

.stock {
  color: #9ca3af;
  font-size: 0.95rem;
}

.stock.agotado {
  color: #f87171;
  font-weight: 700;
}

.acciones {
  display: flex;
  gap: 0.4rem;
}

.acciones button:disabled,
#detalleAddCart:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chip-group {
  display: grid;
  gap: 0.4rem;
}

.chip-label {
  color: #a5b4fc;
  font-size: 0.95rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #0b1220;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip input {
  display: none;
}

.chip input:checked + span {
  color: #fff;
  font-weight: 700;
}

.chip input:checked + span::before {
  content: "• ";
  color: #22d3ee;
}

.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.4rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #1f2937;
  align-items: center;
}

.cart-thumb {
  width: 64px;
  height: 88px;
  border-radius: 10px;
  object-fit: cover;
  background: #0b1220;
}

.cart-controls {
  display: flex;
  gap: 0.3rem;
}

#mensajeCart {
  color: #f87171;
  min-height: 1.2rem;
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  width: 360px;
  height: 100%;
  background: #0f172a;
  border-left: 1px solid #162138;
  box-shadow: -10px 0 30px rgba(0,0,0,0.35);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  z-index: 30;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,12,24,0.55);
  z-index: 25;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #162138;
  border-radius: 10px;
  padding: 0.6rem;
}

.cart-total {
  font-weight: 700;
}

.checkout-form input {
  width: 100%;
  margin: 0.35rem 0;
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #0b1220;
  color: #e2e8f0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.page-loader {
  position: fixed;
  inset: 0;
  background: rgba(10,14,28,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 60;
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: #7c3aed;
  animation: spin 0.9s linear infinite;
}

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

.modal-content {
  background: #0f172a;
  border: 1px solid #162138;
  border-radius: 16px;
  padding: 1.2rem;
  width: min(600px, 90vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  display: grid;
  gap: 0.8rem;
}

#modalProducto .modal-content {
  max-height: 90vh;
  overflow: auto;
}

#modalProducto .row:last-child {
  position: sticky;
  bottom: 0;
  background: #0f172a;
  padding-top: 0.6rem;
  z-index: 1;
}

#modalDetalle .modal-content {
  max-height: 90vh;
  overflow: auto;
  background: radial-gradient(circle at 0% 0%, rgba(124,58,237,0.12), transparent 40%),
              radial-gradient(circle at 100% 0%, rgba(6,182,212,0.12), transparent 35%),
              #0f172a;
  border: 1px solid rgba(148,163,184,0.18);
}

#modalDetalle .modal-header h3 {
  font-size: 1.35rem;
}

#modalDetalle .icon-btn {
  border-radius: 999px;
  padding: 0.45rem 0.6rem;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(148,163,184,0.25);
}

#modalDetalle .detalle-grid {
  align-items: start;
  gap: 1.4rem;
}

#modalDetalle .detalle-info {
  background: rgba(15,23,42,0.4);
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 14px;
  padding: 1rem;
}

#modalDetalle #detalleDesc {
  color: #d1d5db;
  line-height: 1.6;
}

#modalDetalle .pill-row .pill {
  background: rgba(30,41,59,0.9);
  border: 1px solid rgba(148,163,184,0.2);
}

#modalDetalle #detalleAddCart {
  padding: 0.95rem 1.2rem;
  font-size: 1rem;
  border-radius: 12px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  margin: 0.35rem 0;
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #0b1220;
  color: #e2e8f0;
}

.form-grid textarea {
  min-height: 90px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 0.6rem;
}

.row button {
  flex: 1;
}

.file {
  display: block;
  font-size: 0.95rem;
  color: #a5b4fc;
}

.slider-label input[type="range"] {
  width: 100%;
}

.range-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.hidden {
  display: none !important;
}

.carousel {
  position: relative;
  background: #0b1220;
  border-radius: 14px;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel img,
.carousel-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  flex: 0 0 100%;
  scroll-snap-align: center;
  background: #0b1220;
}

.carousel-img.img-loading {
  filter: blur(14px);
  transform: scale(1.02);
  transition: filter 0.3s ease, transform 0.3s ease;
}

.carousel-img:not(.img-loading) {
  transition: filter 0.3s ease, transform 0.3s ease;
}

.card .carousel-img {
  aspect-ratio: 4 / 5;
}

.carousel .carousel-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 0.4rem;
  pointer-events: none;
}

.carousel .carousel-controls button {
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(255,255,255,0.2);
  pointer-events: all;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.modal-wide {
  width: min(860px, 92vw);
}

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

.detalle-info {
  display: grid;
  gap: 0.8rem;
}

.detalle-meta {
  display: grid;
  gap: 0.3rem;
  color: #cbd5e1;
}

.imagenes-actuales {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.imagenes-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
}

.imagen-item {
  display: grid;
  gap: 0.4rem;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #0b1220;
  cursor: grab;
}

.imagen-item.dragging {
  opacity: 0.6;
}

.imagen-item.drop-target {
  border-color: rgba(124,58,237,0.8);
  box-shadow: 0 0 0 2px rgba(124,58,237,0.2);
}

.imagen-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
}

.imagen-del {
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
  background: rgba(248,113,113,0.2);
  border: 1px solid rgba(248,113,113,0.4);
  color: #fecaca;
}

.imagenes-empty {
  margin: 0;
  color: #9ca3af;
  font-size: 0.9rem;
}

@media (max-width: 840px) {
  .drawer {
    width: 100%;
  }
  .detalle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .cards {
    grid-template-columns: repeat(3, minmax(200px, 240px));
  }
}

@media (max-width: 768px) {
  .content {
    padding: 0 0.6rem 2rem;
  }
  section {
    padding: 0.8rem;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 0 0.75rem 2rem;
  }
  section {
    padding: 0.9rem;
  }
  .topbar {
    flex-direction: column;
    gap: 0.6rem;
    align-items: flex-start;
  }
  .row {
    flex-direction: column;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(160px, 220px));
    justify-content: center;
  }
  .class-nav {
    top: 96px;
  }
}
