:root {
  --rojo: #c25252;
  --surface: #0f0f0f;
  --line: rgba(255, 255, 255, 0.09);
  --muted: rgba(255, 255, 255, 0.6);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  font-family: 'Jost', sans-serif;
  background: #000;
  color: white;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

.page {
  width: 100%;
  min-height: 100vh;
  padding-bottom: 70px;
  background: #000;
  overflow: hidden;
}

.catalog-header {
  padding: 20px 20px 28px;
  text-align: left;
}

.topbar {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  margin-bottom: 44px;
}

.home-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  font-size: 16px;
}

.logo {
  width: 94px;
  justify-self: center;
}

.topbar-spacer {
  width: 38px;
}

.eyebrow {
  color: var(--rojo);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin-top: 6px;
  font-size: 38px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.04em;
}

h1::after {
  content: "";
  display: block;
  width: 34px;
  height: 2px;
  margin-top: 14px;
  background: var(--rojo);
}

.intro {
  max-width: 360px;
  margin-top: 15px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.catalog-controls {
  margin: 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.search-field {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.45);
}

.search-field:focus-within {
  border-color: rgba(194, 82, 82, 0.85);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
  font-size: 15px;
}

.search-field input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.select-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.select-grid label > span {
  display: block;
  margin: 0 0 6px 2px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.select-grid select {
  width: 100%;
  min-height: 44px;
  padding: 0 32px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  outline: 0;
  background: #151515;
  color: white;
  font-size: 13px;
}

.availability-filter {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  cursor: pointer;
}

.availability-filter input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.03);
}

.availability-filter input:checked + .checkmark {
  border-color: var(--rojo);
  background: var(--rojo);
}

.availability-filter input:checked + .checkmark::after {
  content: "✓";
  color: white;
  font-size: 13px;
  line-height: 1;
}

.availability-filter input:focus-visible + .checkmark,
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 2px solid white;
  outline-offset: 3px;
}

.catalog-results {
  padding: 28px 20px 0;
}

.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

#result-count {
  font-size: 14px;
  font-weight: 600;
}

.sync-note {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 10.5px;
}

.view-toggle {
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 2px;
  background: var(--surface);
}

.view-button {
  width: 38px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: transparent;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
}

.view-button.is-active {
  background: white;
  color: #111;
}

.view-icon {
  width: 18px;
  height: 15px;
  display: grid;
  gap: 2px;
}

.view-icon-single {
  grid-template-columns: 1fr;
}

.view-icon-compact {
  grid-template-columns: repeat(3, 1fr);
}

.view-icon i {
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.catalog-status {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.catalog-status.is-error {
  padding: 28px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--rojo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.product-grid {
  display: grid;
  gap: 14px;
}

.product-grid.compact-view {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  text-align: left;
}

.product-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f4f4f2;
}

.product-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.image-placeholder {
  padding: 30px;
  color: #777;
  font-size: 13px;
  text-align: center;
}

.product-body {
  padding: 17px;
}

.product-brand {
  color: var(--rojo);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.product-name {
  margin-top: 5px;
  font-size: 20px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.spec-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.spec-list li {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11.5px;
  line-height: 1;
}

.price-block {
  margin-top: 18px;
}

.price-label {
  display: block;
  color: rgba(255, 255, 255, 0.43);
  font-size: 11px;
}

.product-price {
  display: block;
  margin-top: 1px;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.availability {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12.5px;
}

.availability::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #62a977;
  box-shadow: 0 0 0 3px rgba(98, 169, 119, 0.12);
}

.availability.unavailable::before {
  background: #777;
  box-shadow: none;
}

.whatsapp-btn {
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: black;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.button-label-short,
.availability-short {
  display: none;
}

.compact-view .product-card {
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}

.compact-view .product-media {
  flex: 0 0 auto;
}

.compact-view .image-placeholder {
  padding: 8px;
  font-size: 9px;
}

.compact-view .product-body {
  min-width: 0;
  padding: 9px 8px 8px;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.compact-view .product-brand {
  overflow: hidden;
  color: var(--rojo);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-view .product-name {
  min-height: 40px;
  margin-top: 3px;
  display: -webkit-box;
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.compact-view .spec-list,
.compact-view .price-label,
.compact-view .availability-full,
.compact-view .button-label-full {
  display: none;
}

.compact-view .price-block {
  margin-top: auto;
  padding-top: 9px;
}

.compact-view .product-price {
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.compact-view .availability {
  margin-top: 7px;
  align-items: flex-start;
  gap: 5px;
  font-size: 9px;
  line-height: 1.15;
}

.compact-view .availability::before {
  width: 5px;
  height: 5px;
  margin-top: 2px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(98, 169, 119, 0.12);
}

.compact-view .availability-short,
.compact-view .button-label-short {
  display: inline;
}

.compact-view .whatsapp-btn {
  min-height: 34px;
  margin-top: 9px;
  border-radius: 8px;
  font-size: 10.5px;
}

.empty-state {
  padding: 42px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: white;
  font-size: 16px;
}

.empty-state button {
  margin-top: 16px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: transparent;
  color: white;
  cursor: pointer;
}

.catalog-footer {
  margin: 56px 20px 0;
  padding: 28px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  text-align: center;
}

.catalog-footer p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.catalog-footer a {
  min-height: 50px;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (min-width: 900px) {
  body {
    background: #080808;
  }

  body::before {
    content: "Página optimizada para móvil";
    position: fixed;
    top: 40px;
    left: 40px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .page {
    width: 430px;
    min-height: 100vh;
    margin: 0 auto;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.65);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}
