/* ==========================================================================
   SHOP PAGE STYLES - Complete BEM Rebuild
   Modern Vietnamese E-commerce Design
   ========================================================================== */

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

.shop-page-title,
.category-page-title,
.page-title,
.woocommerce-products-header,
.woocommerce-products-header__title,
.term-description,
.woocommerce-result-count,
.woocommerce-ordering {
  display: none !important;
}

/* ==========================================================================
   SHOP HERO / BREADCRUMB
   ========================================================================== */

.ta-shop-hero {
  position: relative;
  padding: var(--space-12) 0;
  background-color: var(--primary);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.ta-shop-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(26, 58, 91, 0.95) 0%,
    rgba(26, 58, 91, 0.75) 100%
  );
  z-index: 1;
}

.ta-shop-hero .container {
  position: relative;
  z-index: 2;
}

.ta-shop-hero__content {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.ta-shop-hero__title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: var(--font-bold);
  color: white;
  margin: 0 0 var(--space-3);
  line-height: var(--leading-tight);
}

.ta-shop-hero__count {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--secondary);
  background: rgba(255, 255, 255, 0.1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  margin: 0;
}

/* Breadcrumb */
.ta-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.ta-breadcrumb__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.ta-breadcrumb__link:hover {
  color: white;
}

.ta-breadcrumb__link svg {
  flex-shrink: 0;
}

.ta-breadcrumb__sep {
  color: rgba(255, 255, 255, 0.4);
  font-size: var(--text-sm);
}

.ta-breadcrumb__current {
  color: white;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

/* ==========================================================================
   CATEGORY DESCRIPTION - Collapsible
   ========================================================================== */

.ta-shop-desc {
  background: var(--gray-50);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border-default);
}

.ta-shop-desc__wrapper {
  position: relative;
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  padding-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.ta-shop-desc__content {
  position: relative;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
}

.ta-shop-desc__text {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.ta-shop-desc__text h2,
.ta-shop-desc__text h3,
.ta-shop-desc__text h4 {
  color: var(--text-primary);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

.ta-shop-desc__text h2:first-child,
.ta-shop-desc__text h3:first-child,
.ta-shop-desc__text h4:first-child {
  margin-top: 0;
}

.ta-shop-desc__text p {
  margin-bottom: var(--space-3);
}

.ta-shop-desc__text p:last-child {
  margin-bottom: 0;
}

.ta-shop-desc__text ul,
.ta-shop-desc__text ol {
  margin-bottom: var(--space-3);
  padding-left: var(--space-5);
}

.ta-shop-desc__text a {
  color: var(--primary);
  text-decoration: underline;
}

/* Fade gradient overlay - visible when collapsed */
.ta-shop-desc__fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.7) 40%,
    rgba(255, 255, 255, 1) 100%
  );
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 1;
}

/* Hide fade when expanded */
.ta-shop-desc__wrapper.is-expanded .ta-shop-desc__fade {
  opacity: 0;
  visibility: hidden;
}

/* Toggle button */
.ta-shop-desc__toggle {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ta-shop-desc__toggle:hover {
  background: var(--primary-dark, #0f2840);
}

.ta-shop-desc__toggle svg {
  transition: transform 0.3s ease;
}

.ta-shop-desc__wrapper.is-expanded .ta-shop-desc__toggle svg {
  transform: rotate(180deg);
}

/* ==========================================================================
   MAIN LAYOUT
   ========================================================================== */

.ta-shop-main {
  padding: var(--space-8) 0;
  background: var(--bg-body);
}

.ta-shop-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 991px) {
  .ta-shop-layout {
    grid-template-columns: 1fr;
  }

  .ta-shop-sidebar {
    order: 2;
  }
}

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

.ta-shop-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

@media (min-width: 992px) {
  .ta-shop-sidebar {
    position: sticky;
    top: 100px;
  }
}

/* Sidebar Widget */
.ta-sidebar-widget {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.ta-sidebar-widget__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--secondary);
}

.ta-sidebar-widget__title svg {
  color: var(--primary);
}

/* Popular Products */
.ta-popular-products {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ta-popular-product {
  display: flex;
  gap: var(--space-3);
  text-decoration: none;
  padding: var(--space-2);
  margin: calc(var(--space-2) * -1);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.ta-popular-product:hover {
  background: var(--gray-50);
}

.ta-popular-product__image {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-100);
}

.ta-popular-product__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ta-popular-product__info {
  flex: 1;
  min-width: 0;
}

.ta-popular-product__title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: var(--leading-snug);
}

.ta-popular-product:hover .ta-popular-product__title {
  color: var(--primary);
}

.ta-popular-product__price {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--secondary);
}

.ta-popular-product__price del {
  color: var(--text-muted);
  font-weight: normal;
  margin-right: var(--space-1);
}

/* Category List */
.ta-category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ta-category-list__item {
  border-bottom: 1px solid var(--border-subtle);
}

.ta-category-list__item:last-child {
  border-bottom: none;
}

.ta-category-list__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.ta-category-list__link:hover {
  color: var(--primary);
  padding-left: var(--space-2);
}

.ta-category-list__item.is-active > .ta-category-list__link {
  color: var(--primary);
  font-weight: var(--font-semibold);
}

.ta-category-list__count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.ta-category-list__item.is-active
  > .ta-category-list__link
  .ta-category-list__count {
  background: var(--primary);
  color: white;
}

/* Children categories */
.ta-category-list__children {
  list-style: none;
  padding: 0 0 var(--space-2) var(--space-4);
  margin: 0;
  display: none;
}

.ta-category-list__item.is-active > .ta-category-list__children,
.ta-category-list__item.is-open > .ta-category-list__children {
  display: block;
}

.ta-category-list__children .ta-category-list__item {
  border-bottom: none;
}

.ta-category-list__children .ta-category-list__link {
  padding: var(--space-2) 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.ta-category-list__children .ta-category-list__link::before {
  content: "−";
  margin-right: var(--space-2);
  color: var(--gray-400);
}

/* ==========================================================================
   PRODUCTS AREA
   ========================================================================== */

.ta-shop-products {
  min-width: 0;
}

/* Toolbar */
.ta-shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.ta-shop-toolbar__count {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.ta-shop-toolbar__sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ta-shop-toolbar__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: none;
  margin-bottom: 0px;
}

@media (min-width: 576px) {
  .ta-shop-toolbar__label {
    display: block;
  }
}

/* Dropdown */
.ta-dropdown {
  position: relative;
}

.ta-dropdown__trigger {
  all: unset;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--gray-50);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 160px;
  justify-content: space-between;
}

.ta-dropdown__trigger:hover {
  border-color: var(--primary);
}

.ta-dropdown__trigger svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ta-dropdown.is-open .ta-dropdown__trigger {
  border-color: var(--primary);
}

.ta-dropdown.is-open .ta-dropdown__trigger svg {
  transform: rotate(180deg);
}

.ta-dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 100%;
  background: white;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  list-style: none;
  padding: var(--space-2);
  margin: 0;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.ta-dropdown.is-open .ta-dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ta-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.ta-dropdown__item:hover {
  background: var(--gray-50);
  color: var(--primary);
}

.ta-dropdown__item.is-active {
  background: var(--primary);
  color: white;
}

.ta-dropdown__item svg {
  flex-shrink: 0;
  margin-left: var(--space-2);
}

/* ==========================================================================
   PRODUCTS GRID
   ========================================================================== */

.ta-products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

@media (max-width: 1199px) {
  .ta-products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575px) {
  .ta-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.ta-shop-pagination {
  margin-top: var(--space-8);
}

.ta-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}

.ta-pagination__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--space-3);
  background: white;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.ta-pagination__item:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.ta-pagination__item.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.ta-pagination__dots {
  padding: 0 var(--space-2);
  color: var(--text-muted);
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.ta-shop-empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.ta-shop-empty svg {
  color: var(--gray-300);
  margin-bottom: var(--space-4);
}

.ta-shop-empty__title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}

.ta-shop-empty__text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin: 0 0 var(--space-6);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.ta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ta-btn--primary {
  background: var(--primary);
  color: white;
}

.ta-btn--primary:hover {
  background: var(--primary-dark, #0f2840);
  color: white;
}

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

@media (max-width: 767px) {
  .ta-shop-hero {
    padding: var(--space-8) 0;
  }

  .ta-shop-desc {
    padding: var(--space-4) 0;
  }

  .ta-shop-desc__wrapper {
    padding: var(--space-4);
  }

  .ta-shop-main {
    padding: var(--space-5) 0;
  }

  .ta-shop-toolbar {
    padding: var(--space-3);
  }

  .ta-products-grid {
    gap: var(--space-3);
  }
}
