/* Catalog Fullpage - Modern UI */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f6f8;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #222;
  scroll-behavior: smooth;
}

.catalog-container {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* ===== ANIMATIONS ===== */

@keyframes catalogFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

@keyframes catalogFadeOpacity {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes catalogSlideInRight {
  from {
    opacity: 0;
    transform: translateX(24px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes catalogSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

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

/* ===== SIDEBAR / FILTERS ===== */

.filter-sidebar {
  width: 280px;
  flex: 0 0 280px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  animation: catalogFadeIn 0.3s ease;
}

.catalog-container.sidebar-collapsed .filter-sidebar {
  display: none;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.filter-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #222;
}

.btn-reset {
  background: none;
  border: none;
  color: #3984be;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.btn-reset:hover {
  text-decoration: underline;
}

.filter-group {
  margin-bottom: 22px;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #999;
}

.price-input {
  flex: 1;
  width: 0;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.price-input:focus {
  outline: none;
  border-color: #3984be;
  box-shadow: 0 0 0 3px rgba(57, 132, 190, 0.12);
}

.input-search {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-search:focus {
  outline: none;
  border-color: #3984be;
  box-shadow: 0 0 0 3px rgba(57, 132, 190, 0.12);
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.category-accordion {
  gap: 0;
  max-height: none;
  overflow: visible;
}

.category-accordion details {
  border-bottom: 1px solid #f0f0f0;
  padding: 8px 0;
  transition: background-color 0.15s ease;
}

.category-accordion details:last-child {
  border-bottom: none;
}

.category-accordion summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  list-style: none;
}

.category-accordion summary::-webkit-details-marker {
  display: none;
}

.category-accordion details[open]>summary span:last-child {
  transform: rotate(180deg);
}

.category-accordion summary span:last-child {
  color: #999;
  transition: transform 0.15s ease;
  font-size: 11px;
}

.sub-category {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 2px 10px;
  animation: catalogSlideDown 0.2s ease;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  transition: color 0.15s ease;
}

.checkbox-label:hover {
  color: #3984be;
}

.checkbox-label input {
  accent-color: #3984be;
  width: 15px;
  height: 15px;
  flex: none;
}

.filter-empty {
  font-size: 12px;
  color: #999;
}

/* ===== MAIN AREA ===== */

.catalog-main {
  flex: 1;
  min-width: 0;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.main-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.main-header h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #222;
}

.btn-toggle-filter {
  width: 40px;
  height: 40px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  font-size: 16px;
  color: #333;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-filter:hover {
  border-color: #3984be;
  color: #3984be;
}

.btn-cart-toggle {
  background: #3984be;
  color: #fff;
  border: none;
  border-radius: 100vmax;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.btn-cart-toggle:hover {
  background: #2f6c98;
}

.badge-count {
  background: #fff;
  color: #3984be;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  padding: 0 5px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  animation: catalogFadeIn 0.3s ease;
}

.product-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.product-select-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  cursor: pointer;
}

.product-select-badge input {
  display: none;
}

.badge-btn {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100vmax;
  background: #f2f2f2;
  color: #666;
  border: 1px solid #e2e2e2;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.product-select-badge input:checked+.badge-btn,
.detail-select-toggle input:checked+.badge-btn {
  background: #3984be;
  color: #fff;
  border-color: #3984be;
}

.product-image {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.product-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-link {
  color: inherit;
  text-decoration: none;
}

.brand-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #3984be;
  background: #eaf3fa;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.catalog-main .product-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  line-height: 1.4;
  margin: 0 0 10px;
  min-height: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.price-current {
  color: #e02b2b;
  font-weight: 700;
  font-size: 15px;
}

.price-old {
  color: #999;
  text-decoration: line-through;
  font-size: 12px;
}

/* ===== DETAIL / QUICK VIEW ===== */

.catalog-detail-view {
  display: none;
  flex-direction: column;
  gap: 18px;
  animation: catalogFadeIn 0.3s ease;
}

.catalog-container.detail-active .catalog-main .product-grid,
.catalog-container.detail-active .catalog-main .catalog-pagination {
  display: none;
}

.catalog-container.detail-active .catalog-detail-view {
  display: flex;
}

/* Sidebar bÃ¡Â»â„¢ lÃ¡Â»Âc bÃ¡Â»â€¹ thay thÃ¡ÂºÂ¿ bÃ¡Â»Å¸i danh sÃƒÂ¡ch sÃ¡ÂºÂ£n phÃ¡ÂºÂ©m khi xem chi tiÃ¡ÂºÂ¿t */
.catalog-container.sidebar-collapsed .filter-sidebar,
.catalog-container.detail-active .filter-sidebar {
  display: none;
}

.detail-back {
  align-self: flex-start;
  background: none;
  border: none;
  color: #3984be;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
  background: #3984be;
  color: #fff;
  border: none;
  border-radius: 100vmax;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.detail-back:hover {
  text-decoration: underline;
}

/* Danh sÃƒÂ¡ch sÃ¡ÂºÂ£n phÃ¡ÂºÂ©m dÃ¡ÂºÂ¡ng thÃ¡ÂºÂ» bÃƒÂªn trÃƒÂ¡i, thay thÃ¡ÂºÂ¿ filter-sidebar khi xem chi tiÃ¡ÂºÂ¿t */
.detail-thumb-row {
  display: none;
  flex: 0 0 280px;
  width: 280px;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding-right: 4px;
  animation: catalogFadeIn 0.3s ease;
}

.catalog-container.detail-active .detail-thumb-row {
  display: flex;
}

.detail-thumb-row .product-card {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.detail-thumb-row .product-card.active {
  border-color: #3984be;
}

.detail-thumb-image {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fb;
  border-radius: 8px;
}

.detail-thumb-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.detail-thumb-info {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.detail-thumb-info .product-title {
  font-size: 13px;
  min-height: 0;
  margin: 0 0 4px;
}

.detail-thumb-info .price-current {
  font-size: 13px;
}

.detail-thumb-info .price-old {
  font-size: 11px;
}

.detail-thumb-row .product-select-badge {
  top: 8px;
  right: 8px;
}

.detail-preview {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  background: #fff;
  border-radius: 14px;
  padding: 32px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  flex-wrap: wrap-reverse;
  transition: opacity 0.15s ease;
}

.detail-preview.is-switching {
  opacity: 0;
}

.detail-info {
  flex: 1 1 260px;
  min-width: 240px;
}

.detail-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #222;
  margin: 0 0 14px;
  line-height: 1.4;
}

.detail-info .product-price {
  margin: 0 0 20px;
  font-size: 16px;
}

.detail-info .price-current {
  font-size: 20px;
}

.detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-select-toggle {
  cursor: pointer;
}

.detail-select-toggle input {
  display: none;
}

.detail-select-toggle .badge-btn {
  padding: 10px 18px;
  font-size: 13px;
  border-radius: 100vmax;
}

.detail-description {
  margin: 20px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: #555;
}

.detail-image-wrap {
  flex: 1 1 320px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-image {
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fb;
  border-radius: 12px;
  overflow: hidden;
}

.detail-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.15s ease;
}

.detail-image img.is-fading {
  opacity: 0;
}

.detail-gallery {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 4px;
}

.detail-gallery-item {
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: #f8f9fb;
  border: 2px solid transparent;
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.detail-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-gallery-item.active {
  border-color: #3984be;
}

/* Danh sÃ¡ch sáº£n pháº©m Ä‘Ã£ chá»n, hiá»‡n ngay dÆ°á»›i khung xem chi tiáº¿t */
.detail-selected-section {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.detail-selected-header {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid #eee;
}

.detail-selected-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.detail-selected-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.detail-selected-list p {
  color: #999;
  font-size: 13px;
}

.detail-selected-section .modal-footer {
  border-top: none;
  padding-top: 0;
}

.detail-selected-section .btn-add-all-cart {
  max-width: 320px;
}

.catalog-empty {
  padding: 60px 20px;
  text-align: center;
  color: #888;
  grid-column: 1 / -1;
}

.catalog-pagination {
  margin: 32px 0 0;
  text-align: center;
  animation: catalogFadeIn 0.3s ease;
}

.catalog-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  margin: 0 3px;
  border-radius: 6px;
  background: #fff;
  color: #333;
  text-decoration: none;
  font-size: 13px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.catalog-pagination .page-numbers:hover {
  background: #eaf3fa;
  color: #3984be;
}

.catalog-pagination .page-numbers.current {
  background: #3984be;
  color: #fff;
}

/* ===== SELECTED PRODUCTS MODAL ===== */

.catalog-modal {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.catalog-modal-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(20, 22, 30, 0.5);
  backdrop-filter: blur(2px);
  animation: catalogFadeOpacity 0.2s ease;
}

.catalog-modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px 0 0 16px;
  padding: 26px 22px 22px;
  max-width: 440px;
  width: 95vw;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-flow: column;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18);
  animation: catalogSlideInRight 0.25s ease;
}

.catalog-modal-content h2 {
  margin: 0 0 18px;
  padding-bottom: 16px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #222;
  border-bottom: 1px solid #eee;
}

.catalog-modal-close {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f2f2f2;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
  transition: all 0.15s ease;
}

.catalog-modal-close:hover {
  background: #e6e6e6;
  color: #222;
}

#selected-products-list {
  margin-top: 0;
  display: flex;
  flex-flow: column;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.selected-product-content {
  display: flex;
  flex-flow: column;
  flex: 1;
  gap: 4px;
}

.selected-product-item {
  width: 100%;
  text-align: left;
  display: flex;
  flex-flow: wrap;
  gap: 6px 14px;
  font-size: 13px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #eee;
  border-radius: 10px;
  align-items: center;
  transition: box-shadow 0.15s ease;
  position: relative;
  align-items: flex-start;
}

.selected-product-item:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.selected-product-item>a {
  grid-row: span 2;
}

.selected-product-item img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8f9fb;
}

.btn-remove-selected {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f7f2f2;
  border: 1px solid #f1dede;
  border-radius: 50%;
  color: #c0392b;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  position: absolute;
  right: 8px;
  top: 8px;
}

.btn-remove-selected:hover {
  background: #d0342c;
  border-color: #d0342c;
  color: #fff;
}

.selected-product-item>div:nth-child(2) {
  font-weight: 600;
  color: #222;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: calc(100% - 78px);
  padding-right: 30px;
}

.selected-product-price {
  color: #e02b2b;
  font-weight: 700;
  width: 100%;
  text-align: right;
}

.selected-product-summary {
  flex: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  font-size: 13px;
  color: #444;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selected-product-summary .row {
  display: flex;
  justify-content: space-between;
}

.selected-product-summary .row.total .value {
  color: #3984be;
  font-weight: 800;
  font-size: 16px;
}

.modal-footer {
  flex: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-add-all-cart {
  width: 100%;
  background: #3984be;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-add-all-cart:hover {
  background: #2f6c98;
}

.btn-add-all-cart:disabled {
  background: #9fc1d8;
  cursor: not-allowed;
}

.add-all-cart-message {
  font-size: 13px;
  line-height: 1.5;
}

.add-all-cart-message:empty {
  display: none;
}

.add-all-cart-message.success {
  color: #1a8f4c;
}

.add-all-cart-message.success a {
  color: #3984be;
  font-weight: 700;
}

.add-all-cart-message.error {
  color: #d0342c;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
  .catalog-container {
    flex-direction: column;
    padding: 16px;
  }

  .filter-sidebar {
    width: 100%;
    flex: 1 1 auto;
    position: static;
    max-height: none;
  }
}

@media (max-width: 600px) {
  .catalog-main .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .product-image {
    height: 130px;
  }

  .main-header {
    flex-flow: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
  }

  .catalog-main .product-grid {
    gap: 12px;
  }
}