/**
 * GMG Prekių filtravimas – stiliai
 * Naudoja kintamuosius iš temos: dt-the7-child/css/01-variables.css
 */

.gmg-product-filter-layout {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  max-width: 100%;
}

.gmg-product-filter-sidebar {
  flex: 0 0 312px;
  min-width: 280px;
}

.gmg-filter-section {
  margin-bottom: 24px;
}

.gmg-filter-title,
.gmg-product-count,
.gmg-filter-subtitle {
  font-family: var(--font-family-secondary);
  font-size: 20px;
  line-height: 27px;
  font-weight: 400;
  text-transform: uppercase;
  margin: 0 0 16px 0;
  color: var(--grey-text-color);
}

.gmg-filter-categories,
.gmg-filter-brands-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gmg-filter-cat-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gmg-filter-subcategories {
  display: none !important;
  flex-direction: column;
  gap: 3px;
}

.gmg-filter-subcategories .gmg-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 6.5px 16px;
  border: 1px solid var(--bg-grey-color);
  border-radius: 25px;
  background: var(--bg-grey-color);
  color: var(--grey-text-color);
  font-family: var(--font-family-secondary);
  font-size: 20px;
  font-weight: 400;
  line-height: 27px;
  cursor: pointer;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease;
  max-width: 280px;
}

.gmg-filter-cat-wrap.gmg-filter-cat-expanded .gmg-filter-subcategories {
  display: flex !important;
}

.gmg-filter-subcat {
  font-size: 0.9rem;
  padding: 8px 14px;
  background: var(--bg-grey-light);
  border-color: var(--light-grey-color);
  color: var(--grey-text-dark);
}

.gmg-filter-subcat:hover {
  background: var(--light-grey-color) !important;
  color: var(--grey-text-color) !important;
}

.gmg-filter-subcat.gmg-filter-btn-active {
  background: var(--light-grey-color) !important;
  color: var(--grey-text-color) !important;
}

.gmg-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8.5px 16px;
  border: 1px solid var(--primary-color-light);
  border-radius: 25px;
  background: transparent;
  color: var(--primary-color);
  font-family: var(--font-family-primary);
  font-size: 24px;
  font-weight: 400;
  line-height: 31px;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease;
  max-width: 280px;
}

.gmg-filter-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--secondary-color);
}

.gmg-filter-btn-active {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: var(--secondary-color) !important;
}

.gmg-filter-brands {
  margin-top: 26px;
}

/* Dropdown trigger – paslėptas desktop, matomas nuo 900px */
.gmg-filter-dropdown-trigger {
  display: none;
}

/* Pagrindinė produkto sritis */
.gmg-product-filter-main {
  flex: 1;
  min-width: 0;
}

.gmg-product-filter-header {
  text-align: center;
  margin-bottom: 20px;
}

.gmg-product-filter-products {
  position: relative;
  min-height: 120px;
}

.gmg-product-filter-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.gmg-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid var(--primary-color-light);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: gmg-spin 0.7s linear infinite;
}

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

.gmg-product-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.gmg-product-filter-grid .gmg-product-card {
  min-width: 0; /* svarbu grid vaikams */
  position: relative; /* sale badge absolute pozicionavimui */
  overflow: visible; /* sale badge nesukirpti */
}

/* Produkto kortelė */
.gmg-product-card,
.gmg-product-card-elementor {
  animation: gmg-fade-in 0.4s ease-out forwards;
  opacity: 0;
  position: relative;
  overflow: visible; /* sale badge nesukirpti */
}

.gmg-product-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
  background: var(--white-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition:
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

.gmg-product-card-link:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.gmg-product-card-image {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-grey-light);
}

.gmg-product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gmg-product-card-content {
  padding: 16px;
}

.gmg-product-card-category {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.gmg-product-card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 8px 0;
}

.gmg-product-card-attributes {
  list-style: none;
  margin: 0 0 8px 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--grey-text-dark);
}

.gmg-product-card-attributes li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gmg-product-card-attributes li::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239eb290'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.gmg-product-card-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: inherit;
}

.gmg-product-card-price del {
  opacity: 0.6;
  font-weight: 500;
}

.gmg-no-products {
  padding: 40px 20px;
  text-align: center;
  font-size: 1rem;
  color: var(--grey-text-dark);
  width: 100%;
  flex: 0 0 100%;
}

/* Pagination */
.gmg-product-filter-pagination {
  margin-top: 40px;
}

.gmg-pagination-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  list-style: none !important;
  margin: 0;
  padding: 0;
}

.gmg-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: var(--grey-text-color);
  font-family: var(--font-family-secondary);
  font-size: 20px;
  line-height: 27px;
  font-weight: 400;
  cursor: pointer;
  background: transparent;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.gmg-pagination-btn:hover {
  color: var(--primary-color);
}

.gmg-pagination-btn.gmg-pagination-current {
  color: var(--primary-color);
}

.gmg-pagination-next,
.gmg-pagination-prev {
  font-size: 38px;
  margin-top: 17px;
}

/* Stagger fade-in animacija kortelėms */
.gmg-product-filter-grid .gmg-product-card:nth-child(1) {
  animation-delay: 0.02s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(2) {
  animation-delay: 0.04s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(3) {
  animation-delay: 0.06s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(4) {
  animation-delay: 0.08s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(5) {
  animation-delay: 0.1s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(6) {
  animation-delay: 0.12s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(7) {
  animation-delay: 0.14s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(8) {
  animation-delay: 0.16s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(9) {
  animation-delay: 0.18s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(10) {
  animation-delay: 0.2s;
}
.gmg-product-filter-grid .gmg-product-card:nth-child(n + 11) {
  animation-delay: 0.22s;
}

@keyframes gmg-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responstyvumas – produktų grid */
@media (max-width: 1399px) {
  .gmg-product-filter-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1299px) {
  .gmg-product-filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 900px: sidebar viršuje, filtras tampa dropdown */
@media (max-width: 900px) {
  .gmg-product-filter-layout {
    flex-direction: column;
  }

  .gmg-product-filter-sidebar {
    flex: none;
    width: 100%;
    order: -1;
  }

  /* Dropdown trigger */
  .gmg-filter-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--primary-color-light);
    border-radius: 12px;
    background: var(--white-color);
    color: var(--primary-color);
    font-family: var(--font-family-primary);
    font-size: 20px;
    font-weight: 400;
    text-transform: uppercase;
    cursor: pointer;
    transition:
      background 0.25s ease,
      border-color 0.25s ease;
  }

  .gmg-filter-dropdown-trigger:hover {
    background: var(--primary-color-overlay);
    border-color: var(--primary-color);
  }

  .gmg-filter-dropdown-trigger::after {
    content: "";
    width: 12px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.25s ease;
  }

  .gmg-product-filter-sidebar.gmg-filter-dropdown-open
    .gmg-filter-dropdown-trigger::after {
    transform: rotate(-135deg);
  }

  /* Dropdown panel – paslėptas pagal nutylėjimą */
  .gmg-filter-dropdown-panel {
    display: none;
    margin-top: 16px;
    padding: 20px;
    background: var(--bg-grey-light);
    border: 1px solid var(--primary-color-light);
    border-radius: 12px;
  }

  .gmg-product-filter-sidebar.gmg-filter-dropdown-open
    .gmg-filter-dropdown-panel {
    display: block;
  }

  .gmg-filter-dropdown-panel .gmg-filter-title {
    display: none;
  }

  .gmg-filter-dropdown-panel .gmg-filter-section {
    margin-bottom: 20px;
  }

  .gmg-filter-dropdown-panel .gmg-filter-section:last-child {
    margin-bottom: 0;
  }

  .gmg-filter-dropdown-panel .gmg-filter-categories,
  .gmg-filter-dropdown-panel .gmg-filter-brands-list {
    flex-direction: column;
  }

  .gmg-filter-dropdown-panel .gmg-filter-btn,
  .gmg-filter-dropdown-panel .gmg-filter-subcategories .gmg-filter-btn {
    max-width: 100%;
  }

  .gmg-filter-section {
    margin-bottom: 16px;
  }

  .gmg-product-filter-grid {
    gap: 16px;
  }

  .gmg-product-card-content {
    padding: 12px;
  }
}

@media (max-width: 600px) {
  .gmg-product-filter-grid {
    gap: 16px;
  }
}

/* Info cards – ikonėlė kairėje prie info_card_title */
.gmg-info-card {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--font-family-secondary);
}

.gmg-info-card-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gmg-info-card-icon img {
  max-height: 72px;
  width: auto;
  object-fit: contain;
}

.gmg-info-card-icon-svg svg {
  height: 72px;
  width: auto;
  display: block;
}

.gmg-info-card-title {
  font-size: 24px;
  line-height: 31px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--primary-color) !important;
  font-family: var(--font-family-primary);
}
