:root {
  --primary: #9C6340;
  --primary-hover: #8A5433;
  --primary-light: #B8805D;
  --surface: #FBF6F2;
  --surface-alt: #F3E9E1;
  --surface-card: #FFFFFF;
  --border: #DBC7B4;
  --text: #2E241E;
  --text-muted: #73594A;
  --success: #37794E;
  --error: #B94A3D;
  --whatsapp: #0F7F42;
  --whatsapp-hover: #0C6E3A;
  --overlay: rgba(46,36,30,0.6);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-card: 0 4px 20px rgba(156,99,64,0.08);
  --shadow-hover: 0 8px 30px rgba(156,99,64,0.18);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1200px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

::selection { background: var(--primary); color: var(--surface); }

/* HEADER */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251,246,242,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header__logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header__logo-lockup {
  height: 60px;
  width: auto;
  color: var(--primary);
}

.header__search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
}

.search__input {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-card);
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  outline: none;
}

.search__input::placeholder { color: var(--text-muted); }
.search__input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(156,99,64,0.12); }

.header__cart-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header__cart-btn:hover { border-color: var(--primary); color: var(--primary); }

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: var(--surface);
  font-size: 0.7rem;
  font-weight: 600;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: var(--transition);
}

.cart-badge--visible { opacity: 1; transform: scale(1); }

/* MAIN LAYOUT */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  min-height: calc(100vh - 140px);
}

/* FILTERS */
.filters {
  position: sticky;
  top: 80px;
  align-self: start;
}

.filters__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.filters__title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--primary);
}

.filters__clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  font-family: 'Inter', sans-serif;
}

.filters__clear:hover { color: var(--primary); }

.filter-group { margin-bottom: 1rem; }

.filter__label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.filter__select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899AA' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.filter__select:focus { border-color: var(--primary); }

/* CATALOG */
.catalog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.catalog__title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
}

.catalog__count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.catalog__header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort__select {
  width: auto;
  padding: 0.4rem 1.75rem 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text);
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899AA' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.sort__select:focus { border-color: var(--primary); }

.loading, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.loading::after {
  content: '';
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* SKELETON LOADING */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.skeleton-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-card__image {
  height: 180px;
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface-card) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-card__body {
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-card__line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface-card) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-card__line--short { width: 60%; }
.skeleton-card__line--medium { width: 80%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.empty-state svg { margin-bottom: 1rem; opacity: 0.5; }

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

.product-card {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.4s ease forwards;
}

.product-card:nth-child(1) { animation-delay: 0.02s; }
.product-card:nth-child(2) { animation-delay: 0.04s; }
.product-card:nth-child(3) { animation-delay: 0.06s; }
.product-card:nth-child(4) { animation-delay: 0.08s; }
.product-card:nth-child(5) { animation-delay: 0.10s; }
.product-card:nth-child(6) { animation-delay: 0.12s; }
.product-card:nth-child(7) { animation-delay: 0.14s; }
.product-card:nth-child(8) { animation-delay: 0.16s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* PRODUCT CARD */
.product-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(156,99,64,0.35);
}

.product-card__image {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--surface-alt), var(--surface-card));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-card__image svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
  transition: var(--transition);
}

.product-card:hover .product-card__image svg {
  opacity: 0.5;
  transform: scale(1.1);
}

.product-card__body {
  padding: 0.875rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.product-card__name {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
}

.product-card__brand {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 400;
}

.product-card__meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.product-card__meta span {
  background: rgba(156,99,64,0.08);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.product-card__footer {
  padding: 0 0.875rem 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-card__price {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: lining-nums;
}

.product-card__btn {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.product-card__btn:hover {
  background: var(--primary);
  color: var(--surface);
}

.product-card__btn--added {
  background: var(--success);
  border-color: var(--success);
  color: white;
  animation: btnFlash 0.4s ease;
}

.product-card--indisponivel .product-card__image img {
  filter: grayscale(0.6);
  opacity: 0.6;
}

.product-card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--error);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.product-card__price--indisponivel {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--error);
}

.product-card__btn--disabled {
  border-color: var(--text-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.product-card__btn--disabled:hover {
  background: transparent;
  color: var(--text-muted);
}

@keyframes btnFlash {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.product-card__qty {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(156,99,64,0.1);
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  padding: 0.2rem;
}

.product-card__qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  transition: var(--transition);
}

.product-card__qty-btn:hover {
  background: var(--primary);
  color: var(--surface);
}

.product-card__qty-val {
  min-width: 20px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

/* CART SIDEBAR */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.cart-overlay--visible { opacity: 1; pointer-events: all; }

.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100vw;
  background: var(--surface-alt);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.cart-sidebar--visible { transform: translateX(0); }

.cart-sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.cart-sidebar__title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  color: var(--primary);
}

.cart-sidebar__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.cart-sidebar__close:hover { color: var(--text); }

.cart-sidebar__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}

.cart-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

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

.cart-item__info { flex: 1; }

.cart-item__name {
  font-size: 0.9rem;
  font-weight: 500;
}

.cart-item__detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cart-item__price {
  font-size: 0.85rem;
  color: var(--primary);
}

.cart-item__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cart-item__qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition);
}

.cart-item__qty-btn:hover { border-color: var(--primary); color: var(--primary); }

.cart-item__qty-value {
  font-size: 0.85rem;
  min-width: 20px;
  text-align: center;
}

.cart-item__remove {
  background: none;
  border: none;
  color: var(--error);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.7;
  transition: var(--transition);
}

.cart-item__remove:hover { opacity: 1; }

.cart-sidebar__footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}

.cart-total strong {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--primary);
  font-variant-numeric: lining-nums;
}

.cart-delivery, .cart-address { display: flex; flex-direction: column; gap: 0.3rem; }

.cart-shipping-note {
  font-size: 0.8rem;
  color: var(--primary);
  background: rgba(156,99,64,0.08);
  border: 1px solid rgba(156,99,64,0.25);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

.delivery__label { font-size: 0.8rem; color: var(--text-muted); }

.delivery__select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.delivery__textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.delivery__textarea:focus { border-color: var(--primary); }

.cart-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--whatsapp);
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.cart-whatsapp-btn:hover { background: var(--whatsapp-hover); transform: translateY(-1px); }

.cart-whatsapp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.cart-privacy {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cart-privacy a { color: var(--primary); }

/* FOOTER */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  text-align: center;
}

.footer__text {
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  color: var(--primary);
}

.footer__privacy {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .main {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .filters {
    position: static;
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
  }

  .filters__header { display: none; }

  .filter-group {
    flex-shrink: 0;
    min-width: 160px;
    margin-bottom: 0;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .product-card__image { height: 130px; }
  .product-card__price { font-size: 1rem; }

  .cart-sidebar { width: 100vw; }

  .header__inner { padding: 0.5rem 1rem; gap: 0.5rem; }
  .header__logo-lockup { height: 48px; }
  .header__search { max-width: 200px; }
}

@media (max-width: 400px) {
  .main { padding: 0.5rem; }
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .product-card__image { height: 110px; }
  .product-card__body { padding: 0.5rem; gap: 0.2rem; }
  .product-card__name { font-size: 0.8rem; }
  .product-card__brand { font-size: 0.7rem; }
  .product-card__meta { font-size: 0.65rem; }
  .product-card__meta span { padding: 0.1rem 0.35rem; }
  .product-card__footer { padding: 0 0.5rem 0.5rem; flex-direction: column; align-items: stretch; gap: 0.4rem; }
  .product-card__price { font-size: 0.9rem; text-align: center; }
  .product-card__btn { width: 100%; text-align: center; }
  .product-card__qty { justify-content: center; }
  .header__logo-lockup { height: 40px; }
  .header__search { max-width: 140px; }
  .search__input { font-size: 0.8rem; padding: 0.5rem 0.75rem; }
  .cart-sidebar__header { padding: 0.75rem; }
  .cart-sidebar__body { padding: 0.75rem; }
  .cart-sidebar__footer { padding: 0.75rem; }
  .catalog__title { font-size: 1.1rem; }
  .skeleton-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .skeleton-card__image { height: 110px; }
}

@media (max-width: 360px) {
  .product-grid { grid-template-columns: 1fr; }
  .skeleton-grid { grid-template-columns: 1fr; }
  .header__inner { flex-wrap: wrap; justify-content: center; }
  .header__search { max-width: 100%; order: 3; margin-top: 0.25rem; }
}
