/**
 * Archive Packaging CSS
 * Tailwind-inspired design for san-pham-bao-bi-giay-co-san category
 */

/* ================================================
   HIDE DEFAULT PAGE TITLES
   ================================================ */

/* Hide various page title elements that might appear */
.shop-page-title,
.woocommerce-products-header,
.woocommerce-products-header__title {
  display: none !important;
}

/* Hide breadcrumb from default WooCommerce (we have our own) */
.woocommerce-breadcrumb:not(.breadcrumb-tanphat) {
  display: none !important;
}

/* ================================================
   LAYOUT STRUCTURE
   ================================================ */

.packaging-archive-page {
  background: var(--tp-gray-50);
  min-height: 100vh;
}

.archive-content-wrapper {
  display: grid;
  grid-template-columns: 1fr 4fr;
  gap: 1rem;
  padding: 1rem 0;
  position: relative;
}

/* Sidebar (3 columns equivalent) */
.archive-sidebar {
  background: var(--tp-white);
  border-radius: 5px;
  height: fit-content;
  position: sticky;
  top: 2rem;
  overflow: hidden;
}

.sidebar-content {
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

/* Main Content (9 columns equivalent) */
.archive-main-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ================================================
   BREADCRUMB (Copied from single product)
   ================================================ */
.product-breadcrumb-section {
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  background-color: var(--tp-gray-100);
}

.breadcrumb-tanphat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--tp-gray-600);
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb-tanphat .breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-tanphat .breadcrumb-item a {
  color: var(--tp-gray-600);
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
}

.breadcrumb-tanphat .breadcrumb-item a:hover {
  color: var(--tp-primary);
  background: var(--tp-gray-200);
}

.breadcrumb-tanphat .breadcrumb-item:last-child {
  color: var(--tp-gray-900);
  font-weight: 500;
}

/* ================================================
   ARCHIVE INFO AND SORTING SECTION
   ================================================ */
.archive-info-sorting {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--tp-gray-200);
}

.archive-info {
  flex: 1;
}

.archive-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--tp-gray-900);
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
}

.archive-description {
  color: var(--tp-gray-600);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0.5rem 0;
}

.archive-count {
  color: var(--tp-gray-500);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.archive-sorting {
  flex-shrink: 0;
  min-width: 200px;
}

.woocommerce-ordering {
  margin: 0;
}

.archive-sorting .orderby {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--tp-gray-300);
  border-radius: 0.375rem;
  background-color: var(--tp-white);
  color: var(--tp-gray-700);
  font-size: 0.875rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.archive-sorting .orderby:hover {
  border-color: var(--tp-primary);
}

.archive-sorting .orderby:focus {
  outline: none;
  border-color: var(--tp-primary);
  box-shadow: 0 0 0 3px rgba(39, 170, 80, 0.1);
}

/* Responsive design for archive info section */
@media (max-width: 768px) {
  .archive-info-sorting {
    flex-direction: column;
    gap: 1rem;
    padding: 0.75rem 0;
  }

  .archive-sorting {
    width: 100%;
    min-width: auto;
  }

  .archive-title {
    font-size: 1.25rem;
  }

  .archive-description {
    font-size: 0.813rem;
  }

  .archive-count {
    font-size: 0.813rem;
  }
}

@media (max-width: 480px) {
  .archive-info-sorting {
    padding: 0.5rem 0;
  }

  .archive-title {
    font-size: 1.125rem;
  }

  .archive-sorting .orderby {
    font-size: 0.813rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
  }
}

/* ================================================
   SIDEBAR STYLING
   ================================================ */

.sidebar-content {
  padding: 1rem;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--tp-gray-900);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--tp-gray-200);
}

.sidebar-title i {
  color: var(--tp-primary);
}

/* ================================================
   CATEGORY HEADER
   ================================================ */

.category-header {
  background: var(--tp-white);
  border-radius: 0.75rem;
  border: 1px solid var(--tp-gray-200);
  padding: 2rem;
}

.category-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--tp-gray-900);
  margin-bottom: 0.5rem;
}

.category-description {
  color: var(--tp-gray-600);
  line-height: 1.6;
}

/* Notifications and Loading States */
.archive-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease;
}

.archive-notification.success {
  background: #10b981;
}

.archive-notification.error {
  background: #ef4444;
}

.archive-notification .notification-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
}

.products-grid.loading {
  opacity: 0.5;
  position: relative;
}

.products-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
  font-weight: 500;
  color: var(--tp-primary);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ================================================
   PRODUCTS GRID & CUSTOM PRODUCT CARDS
   ================================================ */

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: stretch;
}

/* Override default Flatsome product styles for our custom cards */
.products-grid .product-item {
  margin: 0;
  padding: 0;
}

.products-grid .product-item .col-inner {
  padding: 0;
  margin: 0;
}

/* ================================================
   NO PRODUCTS FOUND
   ================================================ */

.no-products-found {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  text-align: center;
}

.no-products-content {
  max-width: 400px;
}

.no-products-content i {
  font-size: 4rem;
  color: var(--tp-gray-400);
  margin-bottom: 1rem;
}

.no-products-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--tp-gray-800);
  margin-bottom: 0.5rem;
}

.no-products-content p {
  color: var(--tp-gray-600);
  margin-bottom: 1.5rem;
}

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

@media (max-width: 1024px) {
  .archive-content-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

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

  .filters-content {
    flex-direction: column;
    gap: 1rem;
  }

  .filter-group {
    min-width: auto;
  }
}

@media (max-width: 768px) {
  .archive-content-wrapper {
    padding: 1rem 0;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .filters-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .price-range .price-inputs {
    flex-direction: column;
    gap: 1rem;
  }

  .price-separator {
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-content {
    padding: 1rem;
  }

  .product-card {
    max-width: none;
  }
}

/* Thêm vào file archive-product.css */

.products-grid.is-loading {
  position: relative;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.products-grid.is-loading::after {
  content: "Đang tải sản phẩm...";
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 255, 255, 0.8);
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  color: var(--text-dark, #11182c);
  z-index: 10;
}

/* ================================================
   SIDEBAR CATEGORIES
   ================================================ */

.product-categories-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-item {
  margin-bottom: 0.5rem;
}

.category-with-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-toggle {
  all: unset;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--tp-gray-500);
  border-radius: 5px;
  transition: all 0.2s ease;
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.category-toggle:hover {
  background-color: var(--tp-gray-100);
  color: var(--tp-primary);
}

.category-toggle i {
  transition: transform 0.2s ease;
  font-size: 0.75rem;
}

.category-item.is-expanded .category-toggle i {
  transform: rotate(90deg);
}

.category-with-toggle .category-link {
  flex: 1;
  margin: 0;
}

.category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.75rem;
  text-decoration: none;
  color: var(--tp-gray-700);
  border-radius: 5px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.category-link:hover {
  background-color: var(--tp-gray-100);
  color: var(--tp-primary);
}

.category-item.is-current .category-link {
  background-color: var(--tp-primary);
  color: white;
}

.category-name {
  flex: 1;
}

.category-count {
  font-size: 0.75rem;
  color: var(--tp-gray-500);
  font-weight: normal;
}

.category-item.is-current .category-count {
  color: rgba(255, 255, 255, 0.8);
}

/* Child Categories */
.child-categories {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
  border-left: 2px solid var(--tp-gray-200);
  padding-left: 1rem;
}

.child-category-item {
  margin-bottom: 0.25rem;
}

.child-category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--tp-gray-600);
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.child-category-link:hover {
  background-color: var(--tp-gray-50);
  color: var(--tp-primary);
}

.child-category-item.is-current .child-category-link {
  background-color: rgba(239, 64, 42, 0.1);
  color: var(--tp-primary);
  font-weight: 500;
}

.child-category-link .category-count {
  font-size: 0.6875rem;
}

/* Ancestor Categories */
.category-item.is-ancestor > .category-link {
  background-color: rgba(239, 64, 42, 0.05);
  color: var(--tp-primary);
  font-weight: 500;
}

.child-category-item.is-ancestor > .child-category-link {
  background-color: rgba(239, 64, 42, 0.05);
  color: var(--tp-primary);
  font-weight: 500;
}

/* Multi-level nested categories */
.child-categories .child-categories {
  border-left-color: var(--tp-gray-300);
  margin-left: 0.5rem;
}

.child-categories .child-categories .child-category-link {
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
}

.child-categories .child-categories .child-categories {
  border-left-color: var(--tp-gray-400);
}

.child-categories .child-categories .child-categories .child-category-link {
  font-size: 0.75rem;
  padding: 0.25rem 0.375rem;
}

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

@media (max-width: 1024px) {
  .archive-main-content {
    order: 1;
  }
  .archive-sidebar {
    order: 2;
    position: static;
    max-height: none;
    height: auto;
  }
}

@media (max-width: 768px) {
  /* Mobile sidebar and layout changes */
  .archive-content-wrapper {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem 0;
  }

  .archive-sidebar {
    order: 2;
    position: static;
    max-height: none;
    height: auto;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .price-range .price-inputs {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .sidebar-content {
    padding: 1rem;
  }

  .product-card {
    max-width: none;
  }
  .product-actions .tp-button {
    font-size: 12px;
    padding: 0.5rem 0.75rem;
    min-height: 35px;
  }
  .product-title-link {
    font-size: 12px;
  }
  .product-card .product-price {
    font-size: 12px !important;
  }
  .product-card .price-note {
    font-size: 12px !important;
  }
  .contact-price-btn {
    font-size: 12px !important;
  }
}

/* ================================================
   SEARCH RESULTS PAGE STYLES
   ================================================ */

/* Search results page container */
#shop-archive.search-page {
  background: var(--tp-gray-50);
  min-height: 100vh;
}

/* Search no results styling */
.no-search-results {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 3rem 1rem;
}

.no-search-results-content {
  text-align: center;
  max-width: 500px;
}

.no-search-icon {
  margin-bottom: 2rem;
  opacity: 0.7;
}

.no-search-results h3 {
  color: var(--tp-gray-900);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.no-search-results p {
  color: var(--tp-gray-600);
  font-size: 1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.no-search-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.no-search-actions .button {
  padding: 5px 15px;
  border-radius: 5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  margin: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  text-transform: none;
}

.no-search-actions .button.primary {
  background: var(--tp-primary, #27aa50);
  color: white;
  border: 1px solid var(--tp-primary, #27aa50);
}

.no-search-actions .button.primary:hover {
  background: var(--tp-primary-dark, #229846);
  border-color: var(--tp-primary-dark, #229846);
  color: white;
}

.no-search-actions .button.secondary {
  background: transparent;
  color: var(--tp-gray-700);
  border: 1px solid var(--tp-gray-300);
}

.no-search-actions .button.secondary:hover {
  background: var(--tp-gray-100);
  color: var(--tp-gray-900);
}
.archive-pagination .page-numbers .current,
.archive-pagination .page-numbers.current {
  background: var(--tp-primary);
  border-color: var(--tp-primary);
  color: white;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.archive-pagination .page-numbers,
.archive-pagination .page-numbers .current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: white;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

/* Mobile responsive for search results */
@media (max-width: 768px) {
  .no-search-results {
    min-height: 300px;
    padding: 2rem 1rem;
  }

  .no-search-icon {
    margin-bottom: 1.5rem;
  }

  .no-search-icon svg {
    width: 60px !important;
    height: 60px !important;
  }

  .no-search-results h3 {
    font-size: 1.25rem;
  }

  .no-search-actions {
    flex-direction: column;
    align-items: center;
  }

  .no-search-actions .button {
    width: 100%;
    max-width: 250px;
  }
}

/* ================================================
   SEARCH PAGE PAGINATION
   ================================================ */

/* Search page pagination */
.search-page .archive-pagination .page-number,
.search-page .archive-pagination .page-numbers .current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: white;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

/* Current/active page */
.search-page .archive-pagination .page-numbers .current,
.search-page .archive-pagination .page-number.current {
  background: var(--tp-primary, #27aa50);
  border-color: var(--tp-primary, #27aa50);
  color: white;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Hover state */
.search-page .archive-pagination .page-number:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  color: #111827;
}

/* Prev/Next arrows */
.search-page .archive-pagination .page-numbers .prev,
.search-page .archive-pagination .page-numbers .next {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-page .archive-pagination .page-numbers .prev:hover,
.search-page .archive-pagination .page-numbers .next:hover {
  background-color: var(--tp-primary, #27aa50);
  border-color: var(--tp-primary, #27aa50);
  color: white;
}

/* Dots/Ellipsis */
.search-page .archive-pagination .page-numbers .dots {
  color: #9ca3af;
  font-weight: 600;
  border: none;
  background: transparent;
}
