:root {
  --bg: #f8f4ef;
  --logo-bg: #85190f;
  --surface: #fff9f2;
  --text: #25170f;
  --muted: #705441;
  --accent: #af7a4f;
  --accent-strong: #8f5f37;
  --line: #e5d7c8;
  --shadow: 0 12px 30px rgba(34, 17, 8, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #fffdf9, var(--bg) 48%);
  user-select: none;
  -webkit-user-select: none;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: var(--logo-bg);
  border-bottom: 1px solid var(--line);
}

.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  min-height: 78px;
}

.brand-logo {
  width: 151px;
  height: 70px;
  object-fit: contain;
}

.main-nav {
  display: flex;
  gap: 12px;
}

.tab-btn,
.admin-link,
.as-link {
  border: 0;
  background: #b47c84;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.tab-btn:focus,
.tab-btn:focus-visible,
.tab-btn:active {
  outline: none;
  box-shadow: none;
}

.tab-btn.active {
  background: #d47876;
  color: #fff;
}

.admin-link {
  background: var(--accent-strong);
  color: #fff;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 20px 20px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

h1,
h2 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
}

.search-wrap input {
  width: min(420px, 100%);
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card.fade-in {
  animation: cardFadeIn 0.35s ease both;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #f1e6d8;
  overflow: hidden;
}

.carousel-track {
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 0.38s ease;
  transform: translateX(calc(var(--index, 0) * -100%));
}

.carousel-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-width: 100%;
}

.carousel-image.active {
  display: block;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  border: 0;
  width: auto;
  height: auto;
  background: transparent;
  color: transparent;
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  text-shadow: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.carousel-arrow.prev {
  left: 8px;
}

.carousel-arrow.next {
  right: 8px;
}

.carousel-arrow::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
}

.carousel-arrow:focus,
.carousel-arrow:focus-visible,
.carousel-arrow:active {
  outline: none;
  box-shadow: none;
  background: transparent;
}

.carousel-arrow.prev::before {
  transform: rotate(-135deg);
}

.carousel-arrow.next::before {
  transform: rotate(45deg);
}

.carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  z-index: 2;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid #8f100e;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.dot.active {
  background: #8f100e;
}

.card-body {
  padding: 14px;
}

.card h3 {
  margin: 0 0 8px;
}

.price {
  margin: 10px 0 8px;
  font-weight: 700;
  color: var(--accent-strong);
}

.sizes {
  color: var(--muted);
  font-size: 0.92rem;
}

.sizes-label,
.sizes-values {
  display: block;
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.catalog-logo {
  width: 174px;
  height: 81px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(270px, 380px) 1fr;
  gap: 26px;
}

.admin-gate {
  max-width: 460px;
  margin: 20px auto 0;
}

.admin-form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
  align-self: start;
}

label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  color: var(--muted);
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
}

input, textarea, select {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

button[type="submit"], .form-actions .secondary {
  border: 0;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

button[type="submit"] {
  background: var(--accent);
  color: #fff;
}

.form-actions .secondary {
  background: #e5d7c8;
}

.admin-item {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}

.admin-item img {
  width: 96px;
  height: 86px;
  border-radius: 8px;
  object-fit: cover;
}

.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-actions button {
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}

.admin-actions .edit {
  background: #d1b08f;
}

.admin-actions .delete {
  background: #b05050;
  color: #fff;
}

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

.whatsapp-float {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 60px;
  height: 60px;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  z-index: 50;
  -webkit-tap-highlight-color: transparent;
}

.whatsapp-float img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.whatsapp-float:focus,
.whatsapp-float:focus-visible,
.whatsapp-float:active {
  outline: none;
  box-shadow: none;
}

@media (max-width: 840px) {
  body {
    font-size: 13px;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 10px 12px;
  }

  .brand-logo {
    width: 177px;
    height: 83px;
  }

  .catalog-logo {
    width: 177px;
    height: 83px;
  }

  .main-nav {
    width: 100%;
    justify-content: center;
    gap: 8px;
  }

  .tab-btn,
  .as-link {
    font-size: 13px;
    padding: 7px 10px;
  }

  main {
    padding: 18px 12px 14px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }

  #categoryTitle {
    font-size: 1.4rem;
  }

  .search-wrap input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: start;
    grid-auto-rows: 1fr;
  }

  .card {
    max-width: 165px;
    width: 100%;
    margin: 0 auto;
    height: 610px !important;
    min-height: 610px !important;
    max-height: 610px !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .card-media {
    aspect-ratio: auto;
    height: 170px;
    max-height: 170px;
  }

  .card-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 440px !important;
    min-height: 440px !important;
    max-height: 440px !important;
    overflow: hidden;
  }

  .card h3 {
    font-size: 1rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 1.35em;
  }

  .card p {
    margin: 0;
    line-height: 1.35;
  }

  .card-body .desc {
    display: flex;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: hidden;
    height: 18.6em;
    min-height: 18.6em;
    max-height: 18.6em;
    text-align: left !important;
  }

  .card-body .desc span {
    display: -webkit-box;
    -webkit-line-clamp: 15;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
    text-align: left !important;
  }

  .price {
    margin-top: auto;
    margin-bottom: 0;
  }

  .sizes {
    display: grid;
    grid-template-rows: auto auto;
    row-gap: 2px;
    overflow: hidden;
    min-height: 2.95em;
    max-height: 2.95em;
    margin: 0;
  }

  .sizes-label {
    line-height: 1.2;
  }

  .sizes-values {
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .carousel-arrow {
    font-size: 34px;
  }

  .carousel-arrow::before {
    width: 13px;
    height: 13px;
    border-top-width: 2px;
    border-right-width: 2px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .admin-form-card {
    position: static;
    padding: 14px;
  }

  .admin-item {
    grid-template-columns: 72px 1fr;
    gap: 8px;
    padding: 8px;
  }

  .admin-item img {
    width: 72px;
    height: 72px;
  }

  .admin-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-end;
  }

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

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

  .whatsapp-float {
    right: 12px;
    bottom: 12px;
    width: 56px;
    height: 56px;
  }

  .whatsapp-float img {
    width: 56px;
    height: 56px;
  }
}

@media (max-width: 520px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card {
    max-width: 150px;
    height: 580px !important;
    min-height: 580px !important;
    max-height: 580px !important;
  }

  .card-media {
    height: 155px;
    max-height: 155px;
  }

  .card-body {
    height: 425px !important;
    min-height: 425px !important;
    max-height: 425px !important;
  }
}
