:root {
  --pink-900: #b40067;
  --pink-700: #e40b7a;
  --pink-500: #ff3ca0;
  --pink-300: #ff8fc5;
  --pink-100: #ffe1f0;
  --bg: #fff7fb;
  --text: #2a1530;
  --muted: #7b5a73;
  --card: #ffffff;
  --shadow: 0 10px 25px rgba(180, 0, 103, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #ffd2ea;
}

.logo-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-link {
  width: fit-content;
  text-decoration: none;
  color: var(--pink-900);
  font-weight: 700;
  font-size: 0.85rem;
}

.home-link:hover {
  text-decoration: underline;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: #fff;
}

.logo h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.1;
}

.logo p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.search-panel {
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-panel label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.search-panel input {
  width: 100%;
  border: 1px solid #ffc4e1;
  background: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.95rem;
  outline: none;
}

.search-panel input:focus {
  border-color: var(--pink-500);
  box-shadow: 0 0 0 3px rgba(255, 60, 160, 0.18);
}

.search-panel small {
  color: var(--muted);
  font-size: 0.8rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
}

.auth-btn {
  border: 1px solid #ffc4e1;
  background: #fff;
  color: var(--pink-900);
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.auth-btn:hover {
  background: #ffe2f1;
}

.cart-btn {
  border: 0;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.productos-main {
  padding: 16px 22px 26px;
}

.productos-section {
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid #ffd6eb;
  background: #fff;
  padding: 18px;
}

.categories-bar {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.categories-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.cat-btn {
  border: 1px solid #ffcbe4;
  background: #fff;
  color: var(--pink-900);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cat-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
  border-color: transparent;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.8vw, 1.8rem);
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: stretch;
  gap: 14px;
}

.producto-card {
  background: var(--card);
  border: 1px solid #ffd6eb;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  overflow: visible;
}

.producto-media {
  position: relative;
  width: 100%;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  perspective: 900px;
}

.producto-media img {
  position: relative;
  z-index: 1;
  width: auto;
  max-width: 96%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  transform: translateY(0) translateZ(0);
  filter: drop-shadow(0 18px 18px rgba(30, 10, 35, 0.28));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.producto-card:hover .producto-media img {
  transform: translateY(-4px) scale(1.01);
  filter: drop-shadow(0 24px 20px rgba(30, 10, 35, 0.3));
}

.offer-badge {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff7a18, #ff3c78);
  box-shadow: 0 8px 18px rgba(255, 60, 120, 0.24);
}

.producto-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.producto-info h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.producto-info p {
  margin: 0;
  color: var(--text);
  line-height: 1.4;
  min-height: 4.2em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qty-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qty-label {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

.qty-input {
  width: 78px;
  border: 1px solid #ffc4e1;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 0.95rem;
  text-align: center;
  color: var(--text);
  background: #fff;
}

.qty-input:focus {
  outline: none;
  border-color: var(--pink-500);
  box-shadow: 0 0 0 2px rgba(255, 60, 160, 0.18);
}

.offer-copy {
  min-height: 2.8em;
  color: var(--pink-900);
  font-size: 0.82rem;
  font-weight: 700;
  display: block;
}

.offer-copy-empty {
  visibility: hidden;
}

.precio-row {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
}

.precio {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pink-900);
}

.price-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 68px;
  justify-content: flex-end;
}

.offer-price-stack {
  gap: 0;
}

.precio-anterior {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: line-through;
}

.precio-oferta {
  color: #ff4a8d;
  font-size: 1.18rem;
}

.btn-carrito {
  border: 0;
  border-radius: 10px;
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.btn-carrito:hover {
  filter: brightness(1.05);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(33, 16, 37, 0.45);
}

.auth-overlay[hidden] {
  display: none;
}

.auth-modal {
  width: min(420px, 100%);
  border-radius: 18px;
  border: 1px solid #ffd2ea;
  background: #fff;
  box-shadow: 0 24px 40px rgba(30, 10, 35, 0.26);
  padding: 16px;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.auth-header h3 {
  margin: 0;
  color: var(--pink-900);
}

.auth-close,
.auth-submit {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
}

.auth-close {
  color: #fff;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.auth-mode-btn {
  border: 1px solid #ffc4e1;
  border-radius: 999px;
  background: #fff;
  color: var(--pink-900);
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}

.auth-mode-btn.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
}

.auth-group {
  display: grid;
  gap: 10px;
}

.auth-group[hidden] {
  display: none;
}

.auth-form label {
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-form input {
  border: 1px solid #ffc4e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--pink-500);
  box-shadow: 0 0 0 3px rgba(255, 60, 160, 0.18);
}

.auth-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-status.error {
  color: #b0005d;
}

.auth-status.success {
  color: #0f7a42;
}

.auth-submit {
  color: #fff;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
}

.forgot-password-link {
  border: 0;
  background: transparent;
  color: var(--pink-700);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease;
}

.forgot-password-link:hover {
  text-decoration-color: var(--pink-700);
}

.reset-phase {
  display: grid;
  gap: 10px;
}

.reset-phase[hidden] {
  display: none;
}

.reset-instructions {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #fef2f8;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  border-left: 3px solid var(--pink-500);
}

.back-to-login-btn {
  border: 1px solid #ffc4e1;
  border-radius: 10px;
  background: #fff;
  color: var(--pink-900);
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.back-to-login-btn:hover {
  background: #ffe8f4;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  padding: 10px 12px;
  border-radius: 10px;
  background: #2a1530;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: radial-gradient(circle at 20% 20%, rgba(255, 119, 182, 0.18), transparent 45%), rgba(24, 10, 28, 0.56);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.cart-container {
  width: min(700px, 100%);
  max-height: 82vh;
  overflow: auto;
  border-radius: 24px;
  border: 1px solid #ffd6ea;
  background: linear-gradient(180deg, #fff 0%, #fff9fc 100%);
  box-shadow: 0 28px 52px rgba(24, 10, 28, 0.3);
  padding: 20px;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cart-header h3 {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  color: var(--pink-900);
}

.cart-close {
  border: 0;
  border-radius: 14px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
}

.cart-items {
  display: grid;
  gap: 12px;
}

.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  align-items: center;
  gap: 14px;
  border: 1px solid #ffd9ed;
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.cart-item p {
  margin: 0;
}

.cart-item img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: #fff;
}

.cart-item span {
  color: #463247;
  font-weight: 600;
}

.cart-item .eliminar {
  border: 1px solid #ffc4e1;
  border-radius: 12px;
  background: #fff;
  color: var(--pink-900);
  padding: 8px 12px;
  cursor: pointer;
}

.cart-item .eliminar:hover {
  background: #ffe2f1;
}

.cart-total {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #ffd9ed;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.25rem;
}

.cart-total strong {
  color: var(--pink-900);
  font-size: clamp(1.8rem, 2.7vw, 2.4rem);
  line-height: 1;
}

.cart-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.cart-actions button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 14px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.16s ease, filter 0.16s ease, background-color 0.16s ease;
}

.cart-actions button:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

.cart-clear {
  border-radius: 0;
  min-height: auto;
  padding: 2px 0;
  background: transparent;
  color: var(--pink-900);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.cart-clear:hover {
  background: transparent;
}

.cart-buy {
  color: #fff;
  background: linear-gradient(135deg, var(--pink-700), var(--pink-500));
}

.estado-grid {
  margin: 16px 0 4px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  min-height: 22px;
}

.estado-grid.error {
  color: #a70052;
}

.skeleton {
  border-radius: var(--radius);
  border: 1px solid #ffd6eb;
  background: linear-gradient(90deg, #fff6fb 20%, #ffe9f4 40%, #fff6fb 60%);
  background-size: 220% 100%;
  min-height: 320px;
  animation: loadingShimmer 1.2s linear infinite;
}

@keyframes loadingShimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -20% 0;
  }
}

@media (max-width: 760px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .search-panel {
    min-width: 0;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .producto-media {
    height: 210px;
    margin-bottom: 10px;
  }

  .cart-item {
    grid-template-columns: 64px 1fr;
    gap: 10px;
  }

  .cart-item span,
  .cart-item .eliminar {
    grid-column: 2;
    justify-self: start;
  }

  .cart-container {
    padding: 16px;
    border-radius: 18px;
  }
}

@media (max-width: 1024px) {
  .header {
    padding: 12px 14px;
  }

  .actions {
    min-width: 0;
    flex-wrap: wrap;
  }

  .productos-main {
    padding: 14px;
  }

  .productos-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 540px) {
  .header {
    padding: 10px;
    gap: 10px;
  }

  .logo {
    gap: 8px;
  }

  .logo img {
    width: 44px;
    height: 44px;
  }

  .logo p {
    display: none;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .search-panel {
    grid-column: 1 / -1;
    order: -1;
  }

  .auth-btn,
  .cart-btn {
    width: 100%;
    text-align: center;
  }

  .productos-main {
    padding: 10px;
  }

  .productos-section {
    padding: 12px;
  }

  .productos-grid {
    grid-template-columns: 1fr;
  }

  .producto-media {
    height: 190px;
  }

  .producto-info p {
    min-height: 0;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}
