/**
 * Webup Woo - Archive Styles
 */

/* Archive container */
.webup-woo-archive {
    padding: 40px 0;
    background-color: var(--webup-woo-bg, #ffffff);
}

/* Archive header */
.webup-woo-archive-header {
    margin-bottom: 30px;
    text-align: center;
}

.webup-woo-archive-title {
    font-size: var(--webup-woo-heading-size, 32px);
    font-weight: 700;
    color: var(--webup-woo-text, #333333);
    margin: 0 0 15px 0;
}

.webup-woo-term-description {
    font-size: 16px;
    color: var(--webup-woo-light-text, #666666);
    max-width: 800px;
    margin: 0 auto;
}

/* Archive layout */
.webup-woo-archive-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.webup-woo-archive.filters-left .webup-woo-archive-layout {
    flex-direction: row;
}

.webup-woo-archive.filters-right .webup-woo-archive-layout {
    flex-direction: row-reverse;
}

/* Sidebar */
.webup-woo-sidebar {
    flex: 0 0 280px;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Main content */
.webup-woo-main {
    flex: 1;
    min-width: 0;
}

/* Toolbar */
.webup-woo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
    padding: 15px 20px;
    background-color: var(--webup-woo-card-bg, #ffffff);
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 8px;
}

.webup-woo-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: transparent;
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--webup-woo-text, #333333);
    cursor: pointer;
    transition: all 0.2s ease;
}

.webup-woo-filter-toggle:hover {
    border-color: var(--webup-woo-primary, #333333);
    color: var(--webup-woo-primary, #333333);
}

.webup-woo-result-count {
    font-size: 14px;
    color: var(--webup-woo-light-text, #666666);
}

.webup-woo-sorting {
    margin-left: auto;
}

.webup-woo-orderby {
    padding: 10px 35px 10px 15px;
    font-size: 14px;
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    background-color: var(--webup-woo-bg, #ffffff);
    color: var(--webup-woo-text, #333333);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.webup-woo-orderby:focus {
    outline: none;
    border-color: var(--webup-woo-primary, #333333);
}

/* Active filters */
.webup-woo-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.webup-woo-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: var(--webup-woo-primary, #333333);
    color: #ffffff;
    font-size: 13px;
    border-radius: 20px;
}

.webup-woo-active-filter-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease;
}

.webup-woo-active-filter-remove:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.webup-woo-active-filter-remove svg {
    width: 10px;
    height: 10px;
    stroke: #ffffff;
}

/* Products grid */
.webup-woo-products-grid {
    display: grid;
    grid-template-columns: repeat(var(--webup-woo-columns, 4), 1fr);
    gap: var(--webup-woo-gap, 20px);
}

/* Product card */
.webup-woo-product-card {
    position: relative;
    background-color: var(--webup-woo-card-bg, #ffffff);
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.webup-woo-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Card image */
.webup-woo-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background-color: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webup-woo-card-link {
    display: block;
    width: 100%;
    height: 100%;
}

.webup-woo-card-img {
    width: 100%;
    height: 100%;
    object-fit: var(--webup-woo-image-fit, cover);
    transition: opacity 0.3s ease;
}

/* Primary image - always visible by default */
.webup-woo-card-img.primary {
    opacity: 1 !important;
}

/* Secondary image - hidden by default, shown on hover */
.webup-woo-card-img.secondary {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0 !important;
}

/* Hover effect - only when secondary image exists */
.webup-woo-product-card.has-secondary-image:hover .webup-woo-card-img.primary {
    opacity: 0 !important;
}

.webup-woo-product-card.has-secondary-image:hover .webup-woo-card-img.secondary {
    opacity: 1 !important;
}

/* Product card without border */
.webup-woo-product-card.no-border {
    border: none;
    box-shadow: none;
}

.webup-woo-product-card.no-border:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Card actions */
.webup-woo-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.webup-woo-product-card:hover .webup-woo-card-actions {
    opacity: 1;
    transform: translateX(0);
}

.webup-woo-quick-view-btn,
.webup-woo-wishlist-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--webup-woo-bg, #ffffff);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.webup-woo-quick-view-btn:hover,
.webup-woo-wishlist-btn:hover {
    background-color: var(--webup-woo-primary, #333333);
    color: #ffffff;
}

.webup-woo-wishlist-btn.active {
    background-color: var(--webup-woo-sale, #e74c3c);
    color: #ffffff;
}

.webup-woo-wishlist-btn.active svg {
    fill: currentColor;
}

/* Card swatches */
.webup-woo-card-swatches {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.webup-woo-product-card:hover .webup-woo-card-swatches {
    opacity: 1;
    transform: translateY(0);
}

.webup-woo-card-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 11px;
    background-color: var(--webup-woo-bg, #ffffff);
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.webup-woo-card-swatch.color {
    width: 24px;
    border-radius: 50%;
}

.webup-woo-card-swatch.image {
    width: 24px;
    background-size: cover;
    background-position: center;
}

.webup-woo-card-swatch.button {
    padding: 0 8px;
}

.webup-woo-card-swatch.more {
    background-color: var(--webup-woo-light-text, #666666);
    color: #ffffff;
    border-color: transparent;
}

/* Card content */
.webup-woo-card-content {
    padding: 15px;
}

.webup-woo-card-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.webup-woo-card-title a {
    color: var(--webup-woo-text, #333333);
    text-decoration: none;
    transition: color 0.2s ease;
}

.webup-woo-card-title a:hover {
    color: var(--webup-woo-primary, #333333);
}

.webup-woo-card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 15px;
}

/* Add to cart in card */
.webup-woo-product-card .webup-woo-add-to-cart {
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
}

.webup-woo-product-card .webup-woo-add-to-cart.disabled {
    background-color: var(--webup-woo-border, #e0e0e0);
    color: var(--webup-woo-light-text, #666666);
    cursor: not-allowed;
}

.webup-woo-product-card .webup-woo-add-to-cart.loading {
    position: relative;
    color: transparent;
}

.webup-woo-product-card .webup-woo-add-to-cart.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: webup-woo-spin 0.6s linear infinite;
}

.webup-woo-product-card .webup-woo-add-to-cart.added {
    background-color: var(--webup-woo-success, #27ae60);
}

/* Pagination */
.webup-woo-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--webup-woo-border, #e0e0e0);
}

.webup-woo-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--webup-woo-text, #333333);
    background-color: var(--webup-woo-bg, #ffffff);
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.webup-woo-pagination .page-numbers:hover,
.webup-woo-pagination .page-numbers.current {
    background-color: var(--webup-woo-primary, #333333);
    border-color: var(--webup-woo-primary, #333333);
    color: #ffffff;
}

.webup-woo-pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* Filter modal */
.webup-woo-filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.webup-woo-filter-modal-content {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 380px;
    height: 100%;
    background-color: var(--webup-woo-bg, #ffffff);
    display: flex;
    flex-direction: column;
    z-index: 1;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.webup-woo-filter-modal.active .webup-woo-filter-modal-content {
    transform: translateX(0);
}

.webup-woo-filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--webup-woo-border, #e0e0e0);
}

.webup-woo-filter-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.webup-woo-filter-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--webup-woo-light-text, #666666);
    transition: color 0.2s ease;
}

.webup-woo-filter-modal-close:hover {
    color: var(--webup-woo-text, #333333);
}

.webup-woo-filter-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.webup-woo-filter-modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--webup-woo-border, #e0e0e0);
}

.webup-woo-filter-modal-footer .webup-woo-filter-clear,
.webup-woo-filter-modal-footer .webup-woo-filter-apply {
    flex: 1;
    padding: 14px 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .webup-woo-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .webup-woo-archive-layout {
        flex-direction: column;
    }

    .webup-woo-sidebar {
        position: static;
        flex: none;
        width: 100%;
        max-height: none;
        display: none;
    }

    .webup-woo-archive.has-filters .webup-woo-sidebar {
        display: none;
    }

    .webup-woo-archive.has-filters .webup-woo-filter-toggle {
        display: inline-flex;
    }
}

@media (max-width: 768px) {
    .webup-woo-archive {
        padding: 20px 0;
    }

    .webup-woo-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .webup-woo-toolbar {
        flex-wrap: wrap;
        padding: 12px 15px;
    }

    .webup-woo-sorting {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }

    .webup-woo-orderby {
        width: 100%;
    }

    .webup-woo-card-content {
        padding: 12px;
    }

    .webup-woo-card-title {
        font-size: 13px;
    }

    .webup-woo-card-actions {
        opacity: 1;
        transform: translateX(0);
    }

    .webup-woo-card-swatches {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .webup-woo-container {
        padding: 0 15px;
    }

    .webup-woo-archive-title {
        font-size: 24px;
    }

    .webup-woo-quick-view-btn,
    .webup-woo-wishlist-btn {
        width: 34px;
        height: 34px;
    }

    .webup-woo-quick-view-btn svg,
    .webup-woo-wishlist-btn svg {
        width: 16px;
        height: 16px;
    }
}
