* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #f5f5f5;
  color: #1e293b;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  text-decoration: none;
  color: #111827;
  font-weight: 700;
}

.brand span {
  color: #ee4d2d;
}

nav a {
  color: #475569;
  text-decoration: none;
  margin-left: 12px;
}

.hero {
  text-align: center;
  margin: 24px 0;
}

.search-form {
  margin: 16px auto 0;
  max-width: 680px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  margin: 0;
  padding: 0 12px 0 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: #eb5a3d;
  box-shadow: 0 0 0 1px #eb5a3d;
}

.search-button {
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: #ee4d2d;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.search-button:hover {
  background: #d83f22;
}

.category-filter-wrap {
  margin: 12px auto 0;
  max-width: 680px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-filter-track {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  flex: 1;
  padding: 2px;
}

.category-filter-track::-webkit-scrollbar {
  display: none;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.category-chip:hover {
  border-color: #f6b3a4;
  color: #d83f22;
}

.category-chip.active {
  border-color: #ee4d2d;
  background: #ee4d2d;
  color: #ffffff;
}

.category-nav-button {
  width: 28px;
  height: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #ffffff;
  color: #64748b;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.category-nav-button.is-visible {
  display: inline-flex;
}

.category-nav-button:hover:not(:disabled) {
  border-color: #ee4d2d;
  color: #ee4d2d;
}

.category-nav-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

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

.pagination {
  margin: 20px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #dbe2ea;
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.pagination-link:hover {
  border-color: #ee4d2d;
  color: #ee4d2d;
}

.pagination-page {
  min-width: 34px;
  padding: 0 8px;
}

.pagination-page.active {
  border-color: #ee4d2d;
  background: #ee4d2d;
  color: #ffffff;
}

.pagination-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.25s ease;
}

.card:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.card img {
  width: 100%;
  height: 165px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.card:hover img {
  transform: scale(1.06);
}

.card-body {
  padding: 12px;
}

.product-title {
  margin: 0;
  line-height: 1.4;
  min-height: calc(1.4em * 3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s ease;
  font-size: 13px;
}

.card:hover .product-title {
  color: #ee4d2d;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}

.product-price {
  font-size: 14px;
  font-weight: 700;
  color: #ee4d2d;
}

.product-sold {
  font-size: 12px;
  color: #64748b;
  text-align: right;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 999px;
  background: #ffe8e3;
  color: #ee4d2d;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
  height: 32.5px;
  padding: 0 12px;
  font-size: 12px;
  border: none;
  border-radius: 8px;
  background: #ee4d2d;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}

.btn svg {
  width: 12px;
  height: 12px;
}

.product-admin-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.product-admin-actions .btn {
  margin-top: 0;
  width: 100%;
}

.product-admin-actions form {
  width: 100%;
  margin: 0;
}

.btn-icon-only {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #eb5a3d;
  border-radius: 8px;
}

.btn-icon-only svg {
  width: 18px;
  height: 18px;
}

.product-admin-actions .btn-icon-only {
  width: 34px;
  justify-self: start;
}

.btn-icon-only:hover {
  background: #fff1ee;
}

.panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}

.admin-actions {
  margin-bottom: 10px;
}

.admin-check-col {
  width: 44px;
  text-align: center;
}

.btn-inline {
  width: auto;
  margin-top: 0;
  min-height: 30px;
  padding: 0 10px;
}

.product-admin-actions .btn-inline {
  width: 100%;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-secondary {
  background: #334155;
}

.btn-secondary:hover {
  background: #1e293b;
}

.admin-wrap {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  margin: 6px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px;
  font-size: 14px;
}

.login-box {
  max-width: 420px;
  margin: 32px auto;
}

.flash {
  padding: 10px;
  border-radius: 8px;
}

.flash.error {
  background: #fee2e2;
  color: #b91c1c;
}

.flash.success {
  background: #dcfce7;
  color: #15803d;
}

.redirect-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.redirect-panel {
  max-width: 520px;
  text-align: center;
}

.product-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 3000;
}

.product-popup-overlay.is-open {
  display: flex;
}

.product-popup {
  width: min(460px, 100%);
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.product-popup::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(238, 77, 45, 0.2) 0%, rgba(238, 77, 45, 0) 70%);
}

.product-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.product-popup-close:hover {
  background: #e2e8f0;
}

.product-popup-header {
  margin-bottom: 10px;
  padding-right: 28px;
}

.product-popup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff1ee;
  color: #ee4d2d;
  font-weight: 700;
  font-size: 12px;
}

.product-popup-header h3 {
  margin: 8px 0 6px;
  font-size: 20px;
  line-height: 1.35;
  color: #0f172a;
}

.product-popup-header p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
}

[data-product-popup-image] {
  width: 100%;
  height: 210px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-top: 8px;
}

.product-popup-price-wrap {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.product-popup-original-price {
  text-decoration: line-through;
  color: #94a3b8;
  font-size: 14px;
}

.product-popup-sale-price {
  color: #dc2626;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.product-popup-highlight-wrap {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-popup-discount {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
}

.product-popup-sold {
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.product-popup-cta {
  margin: 14px auto 0;
  width: 100%;
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #ee4d2d 0%, #fb7b20 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.product-popup-cta:hover {
  filter: brightness(0.96);
}

.title-home {
  font-size: 36px;
  font-weight: 700;
  padding-bottom: 8px;
  span {
    color: #ee4d2d;
  }
}

.desception-home {
  color: #62748e;
  padding-bottom: 26px;
 }

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

  .card img {
    height: 140px;
  }

  .pagination {
    gap: 8px;
  }

  .pagination-link {
    min-height: 32px;
    font-size: 12px;
    padding: 0 10px;
  }

  .pagination-pages {
    width: 100%;
    order: 3;
  }

  [data-product-popup-image] {
    height: 180px;
  }

  .product-popup-header h3 {
    font-size: 18px;
  }
}