/**
 * OPA Commerce - Shop Builder CSS v2
 */

 .opa-shop-container {
    width: 100%;
    max-width: var(--opa-container-width, 1400px);
    margin: 0 auto;
    padding: 15px;
    font-family: var(--opa-font-family, inherit);
    box-sizing: border-box;
}

.opa-shop-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

/* ==============================================
 * Sidebar & Filters
 * ============================================== */
.opa-shop-sidebar {
    position: sticky;
    top: 20px;
    background: var(--opa-surface);
    padding: 20px;
    border-radius: var(--opa-radius);
    border: 1px solid var(--opa-border);
}

.opa-shop-sidebar-close {
    display: none;
    text-align: right;
    cursor: pointer;
    margin-bottom: 20px;
}

.opa-shop-filter-group {
    margin-bottom: 30px;
}

.opa-shop-filter-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--opa-text);
}

.opa-shop-search-input,
.opa-shop-price-inputs input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--opa-border);
    border-radius: var(--opa-radius);
    background: transparent;
    color: var(--opa-text);
    transition: all 0.3s ease;
}
.opa-shop-search-input:focus,
.opa-shop-price-inputs input:focus {
    border-color: var(--opa-primary);
    outline: none;
}

.opa-shop-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.opa-shop-category-list li {
    margin-bottom: 10px;
}

.opa-shop-category-list label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--opa-text);
}

.opa-shop-category-list input {
    margin-right: 10px;
}

.opa-shop-cat-count {
    margin-left: auto;
    color: var(--opa-muted);
    font-size: 0.9em;
}

.opa-shop-price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.opa-shop-price-inputs span {
    color: var(--opa-muted);
}

.opa-shop-clear-filters {
    width: 100%;
    padding: 12px;
    background: var(--opa-surface);
    border: 1px solid var(--opa-border);
    border-radius: var(--opa-radius);
    color: var(--opa-text);
    cursor: pointer;
    transition: all 0.2s;
}

.opa-shop-clear-filters:hover {
    background: var(--opa-primary);
    color: #fff;
    border-color: var(--opa-primary);
}

/* ==============================================
 * Toolbar
 * ============================================== */
.opa-shop-toolbar {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
    background: transparent;
    border: none;
    padding: 0;
}

.opa-shop-toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.opa-shop-sort-select {
    padding: 8px 15px;
    border: 1px solid var(--opa-border);
    border-radius: var(--opa-radius);
    background: #fff;
}

.opa-shop-view-toggle {
    display: flex;
    gap: 5px;
}

.opa-shop-toolbar .opa-view-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    clip-path: none !important;
    border-radius: 8px !important;
    color: var(--opa-muted) !important;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.opa-shop-toolbar .opa-view-btn:hover {
    color: var(--opa-text) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.opa-shop-toolbar .opa-view-btn.active {
    color: var(--opa-primary) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.opa-shop-toolbar .opa-view-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* ==============================================
 * Grid Area
 * ============================================== */
.opa-shop-grid {
    display: grid;
    grid-template-columns: repeat(var(--opa-shop-cols-desktop, 4), 1fr);
    gap: var(--opa-section-gap, 30px) 20px;
    transition: opacity 0.3s;
}

.opa-shop-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background: var(--opa-surface);
    border-radius: var(--opa-radius);
    color: var(--opa-muted);
}

/* List View Override */
.opa-shop-grid.opa-shop-list-view {
    grid-template-columns: 1fr;
}

.opa-shop-grid.opa-shop-list-view .opa-product-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 30px;
    padding: 20px;
    text-align: left;
}

.opa-shop-grid.opa-shop-list-view .opa-pc-image-wrap {
    width: 250px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.opa-shop-grid.opa-shop-list-view .opa-pc-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.opa-shop-grid.opa-shop-list-view .opa-pc-price {
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .opa-shop-grid.opa-shop-list-view .opa-product-card {
        flex-direction: row;
        align-items: center;
        text-align: left;
        padding: 10px;
        gap: 15px;
    }
    
    .opa-shop-grid.opa-shop-list-view .opa-pc-image-wrap {
        width: 120px;
        max-width: none;
    }

    .opa-shop-grid.opa-shop-list-view .opa-pc-content {
        align-items: flex-start;
        padding: 0;
    }

    .opa-shop-grid.opa-shop-list-view .opa-pc-title {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .opa-shop-grid.opa-shop-list-view .opa-pc-price {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .opa-shop-grid.opa-shop-list-view .opa-pc-action {
        margin-top: auto;
    }

    .opa-shop-grid.opa-shop-list-view .opa-pc-action .button,
    .opa-shop-grid.opa-shop-list-view .opa-pc-action .added_to_cart {
        padding: 6px !important;
        font-size: 12px !important;
    }
}

/* ==============================================
 * Pagination
 * ============================================== */
.opa-shop-pagination-wrap {
    text-align: center;
    margin-top: 40px;
}

.opa-shop-load-more {
    background: var(--opa-primary);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: var(--opa-radius);
    cursor: pointer;
    font-size: 16px;
    transition: opacity 0.2s;
}

.opa-shop-load-more:hover {
    opacity: 0.9;
}

.opa-shop-load-more.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ==============================================
 * Mobile Offcanvas
 * ============================================== */
.opa-shop-mobile-filter-btn {
    display: none;
    width: 100%;
    padding: 15px;
    background: var(--opa-primary);
    color: #fff;
    border: none;
    border-radius: var(--opa-radius);
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.opa-shop-sidebar-close {
    display: none;
}

body.opa-no-scroll {
    overflow: hidden;
}

/* Tablet / Small Desktop */
@media (max-width: 1024px) {
    .opa-shop-grid {
        grid-template-columns: repeat(var(--opa-shop-cols-tablet, 3), 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .opa-shop-mobile-filter-btn {
        display: flex;
    }

    .opa-shop-layout {
        grid-template-columns: 1fr;
    }

    .opa-shop-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        z-index: 9999;
        overflow: visible; /* Changed from overflow-y: auto to allow floating button */
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--opa-border);
        transition: left 0.3s ease;
        padding: 0;
    }

    .opa-shop-filters-form {
        height: 100vh;
        overflow-y: auto;
        padding: 20px;
        background: var(--opa-surface);
    }

    .opa-shop-sidebar.active {
        left: 0;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    .opa-shop-sidebar-close {
        display: flex;
        position: absolute;
        top: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--opa-border);
        border-radius: 50%;
        color: var(--opa-text);
        cursor: pointer;
        align-items: center;
        justify-content: center;
        z-index: 10000;
        transition: all 0.2s;
    }
    
    .opa-shop-sidebar-close:hover {
        background: var(--opa-primary);
        color: #fff;
        border-color: var(--opa-primary);
    }
    
    .opa-shop-sidebar-close .dashicons {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }

    .opa-shop-grid {
        grid-template-columns: repeat(var(--opa-shop-cols-mobile, 2), 1fr);
    }

    .opa-shop-toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .opa-shop-toolbar-right {
        justify-content: space-between;
    }
}

.opa-shop-toolbar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.opa-shop-toolbar-bottom {
    width: 100%;
    margin-top: 10px;
    padding-left: 5px;
}

.opa-shop-search-wrapper {
    position: relative;
    width: 100%;
    flex-grow: 1;
}

.opa-shop-search-wrapper .dashicons {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--opa-muted);
    pointer-events: none;
}

.opa-shop-search-input {
    width: 100%;
    padding-right: 45px;
    background: rgba(255, 255, 255, 0.03) !important;
}

.opa-shop-search-input:focus {
    background: rgba(255, 255, 255, 0.08) !important;
}

.opa-shop-product-count {
    display: block;
    font-size: 13px;
    color: var(--opa-muted);
}
