/* storefront/app/static/css/catalog.css */

/* Core layout */
main.container {
    max-width: 1800px;
    width: 100%;
    padding: 0;
}

.catalog-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

.catalog-container {
    max-width: 1800px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
}

.catalog-content {
    width: 100%;
}

.catalog-header {
    margin-bottom: 1rem;
    background: var(--secondary-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Filters Sidebar */
.filters-sidebar {
    position: sticky;
    top: 2rem;
}

.filters {
    background: var(--secondary-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 1rem;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.filters-header h2 {
    color: var(--text-primary);
}

.clear-all {
    background: none;
    border: none;
    color: var(--button-primary);
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--button-primary);
}

.filter-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
}

.filter-toggle:hover {
    background-color: var(--hover-color);
}

.filter-content {
    overflow: hidden;
    transition: all 0.2s ease-out;
    opacity: 1;
    transform-origin: top;
    transform: scaleY(1);
    padding: 12px;
}

.filter-section.collapsed .filter-content {
    padding: 0 12px;
    opacity: 0;
    transform: scaleY(0);
    height: 0;
}

.filter-section:not(.collapsed) .filter-content {
    height: auto;
}

.filter-section:not(.collapsed) .toggle-icon {
    transform: rotate(45deg);
}

.toggle-icon {
    transition: transform 0.2s ease-out;
    color: var(--text-secondary);
}

.count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Price Range Inputs */
.price-range {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.range-inputs input[type="number"] {
    width: 80px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--secondary-color);
    color: var(--text-primary);
}

input[type="range"] {
    accent-color: var(--button-primary);
}

/* Products Grid Container */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 2.5rem;
    padding: 2.5rem;
}

/* Container style update */
.products-grid-container {
    height: 80vh;
    overflow-y: auto;
    border: none;
    border-radius: 0;
    background: var(--secondary-color);
    padding: 0.5rem;
}

/* Product Cards */
.product-card {
    background: var(--secondary-color);
    border: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Only apply hover effects when not scrolling */
.products-grid-container:not(.is-scrolling) .product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.product-image-container {
    position: relative;
    overflow: hidden;
}

.product-image {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    width: 100%;
    background: var(--secondary-color);
    transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 2px;
    text-transform: uppercase;
    z-index: 2;
}

.stock-badge.in-stock {
    background: rgba(0, 0, 0, 0.7);
    color: white;
}

.stock-badge.out-of-stock {
    background: rgba(0, 0, 0, 0.7);
    color: #ff6b6b;
}

.product-info {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    text-align: center;
}

.product-brand {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
    color: var(--text-secondary);
}

.product-name {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.2px;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.4;
}

.product-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-name a:hover {
    color: var(--icy-blue);
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}


.product-price {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
    color: var(--text-primary);
}

.product-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}


.btn-quick-view {
    flex: 1;
    padding: 0.5rem 1rem;
    background: var(--button-secondary);
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-quick-view:hover {
    background: var(--button-secondary-hover);
}

/* Stock Status */
.stock {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.in-stock {
    background: rgba(0, 200, 83, 0.2);
    color: var(--success-color);
}

.out-of-stock {
    background: rgba(255, 82, 82, 0.2);
    color: var(--error-color);
}

/* Empty State */
.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.btn-clear-filters {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--button-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-clear-filters:hover {
    background: var(--icy-blue);
}

/* Custom Scrollbar */
.products-grid-container::-webkit-scrollbar,
.filters-sidebar::-webkit-scrollbar {
    width: 8px;
}

.products-grid-container::-webkit-scrollbar-track,
.filters-sidebar::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 4px;
}

.products-grid-container::-webkit-scrollbar-thumb,
.filters-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.products-grid-container::-webkit-scrollbar-thumb:hover,
.filters-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Quick View Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--secondary-color);
    padding: 2rem;
    border-radius: 8px;
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.quick-view-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.quick-view-image {
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: 4px;
    background: var(--secondary-color);
}

.quick-view-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.quick-view-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quick-view-details h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
}


/* Size information styling */
.product-size {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Quick view modal size information */
.quick-view-details .product-size {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--secondary-color);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

/* Size filter item styling */
.checkbox-label[data-filter="size"] {
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Improved Sort Select Dropdown */
.sort-select {
    appearance: none;
    background-color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.7rem 2.5rem 0.7rem 1rem;
    width: 100%;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
}

.sort-select:focus {
    outline: none;
    border-color: var(--icy-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.sort-select:hover {
    border-color: var(--icy-blue);
    background-color: var(--secondary-color);
}

/* Image carousel styling */
.product-image {
  position: relative;
  overflow: hidden;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}


.carousel-arrow.prev {
  left: 10px;
}

.carousel-arrow.next {
  right: 10px;
}



.mobile-filter-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  font-weight: 500;
  width: 100%;
  transition: all 0.2s ease;
}

.mobile-filter-toggle:before {
  content: '\f0b0'; /* Filter icon */
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-size: 1rem;
}


/* Responsive styles */
@media (max-width: 991px) {
  .catalog-container {
    padding: 1rem;
    gap: 1.5rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .products-grid-container {
    height: 70vh;
  }

  .clear-all {
      margin-right: 2rem;
  }

}

@media (max-width: 768px) {
  .catalog-container {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
    position: relative;
  }

  /* Show mobile filter toggle */
  .mobile-filter-toggle {
    display: flex;
  }

  /* Create a version of the filters for mobile */
  .filters-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    z-index: 1000;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    padding: 1rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  }

  /* Show filters when they have the active class */
  .filters-sidebar.active {
    transform: translateX(0);
  }

  .filters {
    height: 100%;
    border-radius: 0;
    padding: 0;
    border: none;
  }

  /* Close button for mobile filters */
  .filters-header {
    position: sticky;
    top: 0;
    background: var(--primary-color);
    z-index: 10;
    padding: 1rem 0;
  }

  .filters-header:after {
    content: '\f00d'; /* × icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
  }

  .clear-all {
      margin-right: 2rem;
  }

  /* Products grid adjustments */
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 1rem;
  }

  .products-grid-container {
    height: auto;
    max-height: none;
    overflow-y: visible;
  }

  /* Product card adjustments */
  .product-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .product-info {
    padding: 1rem 0.5rem;
    gap: 0.25rem;
  }

  .product-name {
    font-size: 0.9rem;
  }

  .product-brand {
    font-size: 0.75rem;
  }

  .product-price {
    font-size: 0.9rem;
  }

  /* Quick view modal adjustments */
  .modal-content {
    padding: 1.5rem;
    width: 95%;
  }

  .quick-view-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .quick-view-image {
    max-height: 300px;
  }

  .quick-view-details h2 {
    font-size: 1.2rem;
  }
}

/* Small mobile phones */
@media (max-width: 400px) {
  .catalog-container {
    padding: 0.5rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .product-info {
    padding: 0.75rem 0.25rem;
  }

  .product-name {
    font-size: 0.8rem;
  }

  .product-price {
    font-size: 0.85rem;
  }

  .mobile-filter-toggle {
    font-size: 0.9rem;
    padding: 0.6rem 0.75rem;
  }
}

/* Add this to enable opening/closing filters with JS */
.js-filter-toggle {
  display: none;
}

.js-filter-toggle:checked + .filters-sidebar {
  transform: translateX(0);
}

/* Additional styles for filter visibility */
.filter-section {
  transition: margin-bottom 0.3s ease, opacity 0.3s ease;
}

/* Always show filter sections on mobile without collapse */
@media (max-width: 768px) {
  .filter-section.collapsed .filter-content {
    height: auto;
    opacity: 1;
    transform: scaleY(1);
    padding: 12px;
  }

  .filter-toggle .toggle-icon {
    display: none;
  }
}

/* Show arrows on hover on desktop */
@media (min-width: 769px) {
  .product-image:hover .carousel-arrow {
    opacity: 1;
  }
}

/* Always show arrows on mobile */
@media (max-width: 768px) {
  .carousel-arrow {
    opacity: 1;
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
}

.carousel-arrow:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

/* Add smooth transition for image changes */
.product-image img {
  transition: opacity 0.3s ease;
}

/* Active image state */
.product-image img.active {
  opacity: 1;
}

/* Loading state */
.product-image img.loading {
  opacity: 0.7;
}
