/**
 * 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;
}

.webup-woo-price-from {
    font-size: 0.8em;
    color: var(--webup-woo-light-text, #666);
}

/* 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;
    }
}

/* ==========================================================================
   Product card: ny layout — rating, title+energy, USPs, prisblok
   ========================================================================== */

/* Star rating */
.webup-woo-card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px 0;
}

.webup-woo-card-stars {
    display: flex;
    gap: 2px;
}

.webup-woo-card-star {
    width: 16px;
    height: 16px;
    fill: #ddd;
    stroke: none;
}

.webup-woo-card-star.filled {
    fill: #f5a623;
}

.webup-woo-card-star.half {
    fill: url(#half-gradient);
}

.webup-woo-card-rating-text {
    font-size: 12px;
    color: var(--webup-woo-light-text, #666);
}

/* Title row: title block left + energy block right */
.webup-woo-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.webup-woo-card-title-block {
    flex: 1;
    min-width: 0;
}

.webup-woo-card-title-block .webup-woo-card-title {
    margin-bottom: 2px;
}

.webup-woo-card-sku {
    font-size: 12px;
    color: var(--webup-woo-light-text, #888);
}

/* Energy block (right side) */
.webup-woo-card-energy-block {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.webup-woo-card-energy-img {
    max-height: 70px;
    width: auto;
    display: block;
}

.webup-woo-card-energy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 3px;
    line-height: 1;
}

.webup-woo-card-energy-link {
    font-size: 11px;
    color: var(--webup-woo-primary, #333);
    text-decoration: underline;
    white-space: nowrap;
}

.webup-woo-card-energy-link:hover {
    opacity: 0.75;
}

/* USPs */
.webup-woo-card-usps {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.webup-woo-card-usps li {
    font-size: 13px;
    color: var(--webup-woo-light-text, #555);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.webup-woo-card-usps li::before {
    content: '›';
    font-size: 16px;
    line-height: 1;
    color: var(--webup-woo-text, #333);
    font-weight: 700;
    flex-shrink: 0;
}

/* Price block — boxed */
.webup-woo-card-price-block {
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 14px;
}

.webup-woo-card-sale-label {
    display: block;
    background: var(--webup-woo-sale-block-bg, #f5d327);
    color: var(--webup-woo-sale-block-color, #000);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
}

.webup-woo-card-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 10px 4px;
}

.webup-woo-card-price-row .webup-woo-price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--webup-woo-price-color, #333);
}

.webup-woo-card-price-row .webup-woo-price-current .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
}

.webup-woo-card-price-row .webup-woo-price-original {
    font-size: 0.85rem;
    color: var(--webup-woo-light-text, #888);
    text-decoration: line-through;
}

.webup-woo-card-price-row .webup-woo-price-from-label {
    font-size: 0.75em;
    color: var(--webup-woo-light-text, #666);
}

.webup-woo-card-excl-text {
    font-size: 11px;
    color: var(--webup-woo-light-text, #888);
    padding: 0 10px 6px;
}

/* Widget grid: respect tablet/mobile column variables */
@media (max-width: 1024px) {
    .webup-woo-widget-products .webup-woo-products-grid {
        grid-template-columns: repeat(var(--webup-woo-columns-tablet, 2), 1fr);
    }
}

@media (max-width: 767px) {
    .webup-woo-widget-products .webup-woo-products-grid {
        grid-template-columns: repeat(var(--webup-woo-columns-mobile, 2), 1fr);
    }
}

/* ==========================================================================
   Widget slider
   ========================================================================== */

.webup-woo-widget-slider {
    position: relative;
    padding: 0 44px;
}

.webup-woo-widget-slider .webup-woo-slider-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: var(--webup-woo-gap, 20px);
    padding-bottom: 4px;
}

.webup-woo-widget-slider .webup-woo-slider-track::-webkit-scrollbar {
    display: none;
}

.webup-woo-widget-slider .webup-woo-slider-track .webup-woo-product-card {
    flex: 0 0 calc(
        (100% - (var(--webup-woo-columns, 4) - 1) * var(--webup-woo-gap, 20px))
        / var(--webup-woo-columns, 4)
    );
    scroll-snap-align: start;
    min-width: 0;
}

.webup-woo-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: var(--webup-woo-bg, #fff);
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
    transition: background 0.2s, border-color 0.2s;
    color: var(--webup-woo-text, #333);
    padding: 0;
}

.webup-woo-slider-nav:hover {
    background: var(--webup-woo-primary, #333);
    border-color: var(--webup-woo-primary, #333);
    color: #fff;
}

.webup-woo-slider-nav.prev { left: 0; }
.webup-woo-slider-nav.next { right: 0; }
.webup-woo-slider-nav.hidden { opacity: 0; pointer-events: none; }

@media (max-width: 1024px) {
    .webup-woo-widget-slider .webup-woo-slider-track .webup-woo-product-card {
        flex-basis: calc(
            (100% - (var(--webup-woo-columns-tablet, 2) - 1) * var(--webup-woo-gap, 20px))
            / var(--webup-woo-columns-tablet, 2)
        );
    }
}

@media (max-width: 767px) {
    .webup-woo-widget-slider {
        padding: 0 36px;
    }
    .webup-woo-widget-slider .webup-woo-slider-track .webup-woo-product-card {
        flex-basis: calc(
            (100% - (var(--webup-woo-columns-mobile, 2) - 1) * var(--webup-woo-gap, 20px))
            / var(--webup-woo-columns-mobile, 2)
        );
    }
}

/* ==========================================================================
   Elementor Widget: Webup Produktgrid
   ========================================================================== */

.webup-woo-widget-products {
    width: 100%;
}

.webup-woo-widget-heading {
    margin: 0 0 24px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--webup-woo-text, #333);
}

.webup-woo-widget-empty {
    color: #888;
    font-style: italic;
}

.webup-woo-widget-view-all {
    margin-top: 30px;
    text-align: center;
}

.webup-woo-widget-btn {
    display: inline-block;
    padding: 12px 32px;
    background: var(--webup-woo-primary, #333);
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: 3px;
    transition: opacity 0.2s;
}

.webup-woo-widget-btn:hover {
    opacity: 0.85;
    color: #fff;
}
