/* WCC Search Filter Styles */

/* Toggle button for mobile */
.wcc-filter-toggle {
    display: none;
    width: 100%;
    padding: 12px 16px;
    background: #475569;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.wcc-filter-toggle:hover {
    background: #334155;
}

.wcc-toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.wcc-filter-toggle.active .wcc-toggle-icon {
    transform: rotate(180deg);
}

/* Mobile: Show toggle, hide form by default */
@media (max-width: 1023px) {
    .wcc-filter-toggle {
        display: flex;
    }
    
    #wcc-filter-form {
        display: none !important;
        animation: slideDown 0.3s ease;
    }
    
    #wcc-filter-form.visible {
        display: grid !important;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 2000px;
    }
}

/* Desktop: Always show form, hide toggle */
@media (min-width: 1024px) {
    .wcc-filter-toggle {
        display: none !important;
    }
    
    #wcc-filter-form {
        display: grid !important;
    }
}

/* Responsive grid for narrow laptops (1024px - 1279px) - make filter slightly wider but not too much */
@media (min-width: 1024px) and (max-width: 1279px) {
    aside {
        grid-column: span 1 !important;
        max-width: 320px;
    }
    
    #wcc-filter-results {
        grid-column: span 3 !important;
    }
}

.wcc-filter-container {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.wcc-filter-form {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
}

/* Horizontal Layout (default) */
.wcc-layout-horizontal .wcc-filter-form {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* Vertical Layout */
.wcc-layout-vertical .wcc-filter-form {
    grid-template-columns: 1fr;
    /* max-width: 400px; - Removed to fill container properly */
}

.wcc-filter-field {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent overflow */
}

.wcc-filter-field label {
    font-weight: 600;
    margin-bottom: 4px;
    color: #222;
    font-size: clamp(11px, 2vw, 13px);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wcc-filter-select,
.wcc-filter-field input[type="number"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    
    padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px);
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: clamp(12px, 2vw, 14px);
    line-height: 1.4;
    transition: border-color 0.2s;
    background: #fff;
    color: #333;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.wcc-filter-select:focus,
.wcc-filter-field input[type="number"]:focus {
    outline: none;
    border-color: #999;
}

.wcc-range-inputs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(4px, 1vw, 8px);
    width: 100%;
    box-sizing: border-box;
}

.wcc-range-inputs input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 60px;
}

.wcc-range-separator {
    color: #666;
    font-weight: 500;
    flex: 0 0 auto;
}

.wcc-filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    grid-column: 1 / -1;
    margin-top: 5px;
}

.wcc-results-count {
    grid-column: 1 / -1;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    text-align: center;
    margin-top: 5px;
}

.wcc-results-count #wcc-count-number {
    font-weight: 700;
    color: #0073aa;
}

.wcc-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcc-btn-primary {
    background: #a46497;
    color: #fff;
}

.wcc-btn-primary:hover {
    background: #935386;
    opacity: 0.95;
}

.wcc-btn-secondary {
    background: #f7f7f7;
    color: #515151;
    border: 1px solid #e5e5e5;
}

.wcc-btn-secondary:hover {
    background: #ececec;
    border-color: #ccc;
}

.wcc-icon {
    font-size: 14px;
    line-height: 1;
}

/* Custom select arrow */
.wcc-filter-select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

/* Remove list styling if present */
.wcc-filter-container ul,
.wcc-filter-container li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Results Section */
.wcc-filter-results {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e5e5e5;
}

.wcc-results-info {
    margin-bottom: 15px;
}

.wcc-results-info p {
    font-size: 14px;
    color: #666;
    margin: 0;
    font-style: italic;
}

/* Product grid uses WooCommerce native classes */
.wcc-filter-results ul.products {
    margin-top: 20px !important;
    list-style: none !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
}

.wcc-filter-results ul.products.columns-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.wcc-filter-results ul.products li.product {
    text-align: center;
    margin: 0 !important;
    width: 100% !important;
    float: none !important;
    padding: 10px !important;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
}

.wcc-filter-results ul.products li.product img {
    max-width: 250px !important;
    max-height: 250px !important;
    width: 250px !important;
    height: 250px !important;
    object-fit: cover !important;
    margin: 0 auto !important;
    display: block !important;
}

.wcc-filter-results ul.products li.product .woocommerce-LoopProduct-link--image img {
    max-width: 250px !important;
    max-height: 250px !important;
    width: 250px !important;
    height: 250px !important;
}

.wcc-filter-results ul.products li.product .woocommerce-LoopProduct-link--image {
    display: block;
    margin-bottom: 8px;
}

.wcc-filter-results ul.products li.product .woocommerce-LoopProduct-link {
    display: block;
    text-decoration: none;
}

.wcc-filter-results ul.products li.product .woocommerce-loop-product__title {
    font-size: 0.9em;
    margin: 8px 0 5px;
    font-weight: 600;
    line-height: 1.3;
}

.wcc-filter-results ul.products li.product .wcc-car-specs {
    display: block;
    margin: 10px 0 8px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}

.wcc-filter-results ul.products li.product .wcc-car-specs span {
    display: inline;
    margin-right: 4px;
}

.wcc-filter-results ul.products li.product .wcc-car-specs span:not(:last-child):after {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    background: #999;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
}

.wcc-filter-results ul.products li.product .price {
    display: block;
    color: #77a464;
    font-weight: 700;
    font-size: 1em;
    margin-top: 6px;
}

/* Responsive - 2 columns on tablets */
@media (max-width: 992px) {
    .wcc-filter-results ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive - 1 column on mobile */
@media (max-width: 600px) {
    .wcc-filter-results ul.products {
        grid-template-columns: 1fr;
    }
}

.wcc-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.wcc-no-results p {
    font-size: 16px;
    color: #666;
    margin: 10px 0;
}

/* Loading State */
.wcc-filter-results.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.wcc-filter-results.loading::after {
    content: "Laden...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    padding: 20px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-weight: 600;
    color: #0073aa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wcc-layout-horizontal .wcc-filter-form {
        grid-template-columns: 1fr;
    }
    
    .wcc-filter-actions {
        flex-direction: column;
    }
    
    .wcc-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Features Scrollbox (Added for categorized features) */
.wcc-features-scrollbox {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 12px;
    border-radius: 4px;
    background: #fff;
    /* Custom Scrollbar for webkit */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}
.wcc-features-scrollbox::-webkit-scrollbar {
    width: 6px;
}
.wcc-features-scrollbox::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.wcc-features-scrollbox::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.wcc-feat-cat-header {
    font-weight: 700;
    margin: 10px 0 5px;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #64748b; /* slate-500 matching theme */
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 3px;
    letter-spacing: 0.05em;
}
.wcc-feat-cat-header:first-child {
    margin-top: 0;
}

.wcc-features-scrollbox label {
    display: flex;
    align-items: flex-start; /* Align checkbox with top of text if text wraps */
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: normal; 
    text-transform: none;
    line-height: 1.4;
    color: #334155; /* slate-700 */
}
.wcc-features-scrollbox label:hover {
    color: #ef4444; /* red-500 matching theme brand */
}
.wcc-features-scrollbox input[type="checkbox"] {
    margin-top: 3px; /* visual alignment */
}

/* Compact padding for vertical layout in sidebars */
.wcc-filter-container.wcc-layout-vertical {
    padding: 20px 15px;
}

/* ===== ACTIVE FILTERS DISPLAY ===== */
.wcc-active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 20px;
}

.wcc-active-filters-label {
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcc-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.wcc-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    color: #334155;
}

.wcc-filter-tag button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: #e2e8f0;
    border-radius: 50%;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.wcc-filter-tag button:hover {
    background: #ef4444;
    color: #fff;
}

.wcc-clear-all {
    padding: 6px 12px;
    border: 1px solid #dc2626;
    background: transparent;
    color: #dc2626;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.wcc-clear-all:hover {
    background: #dc2626;
    color: #fff;
}

/* Sorting dropdown styling */
#wcc-sort {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 18px;
    padding-right: 30px;
}

/* Loading state for model dropdown */
#wcc-model:disabled {
    background-color: #f3f4f6;
    cursor: wait;
}

/* Mobile responsive for active filters */
@media (max-width: 600px) {
    .wcc-filter-form {
        gap: 8px;
    }
    
    .wcc-filter-field label {
        font-size: 11px;
        margin-bottom: 4px;
    }
    
    .wcc-filter-select,
    .wcc-filter-field input[type="number"] {
        padding: clamp(5px, 1.5vw, 6px) clamp(7px, 1.5vw, 8px);
        font-size: 12px;
    }
    
    /* Stack range inputs vertically on mobile */
    .wcc-range-inputs {
        flex-direction: column;
        gap: 6px;
    }
    
    .wcc-range-separator {
        display: none;
    }
    
    .wcc-active-filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wcc-active-filters-list {
        width: 100%;
    }
    
    .wcc-clear-all {
        width: 100%;
        text-align: center;
    }
}

/* Tablet responsive (768px - 1023px) */
@media (min-width: 601px) and (max-width: 1023px) {
    .wcc-sidebar-filter-wrapper {
        padding: 0;
        margin-bottom: 1.5rem;
    }
    
    .wcc-sidebar-filter-wrapper h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
        padding-left: 0;
    }
    
    .wcc-filter-form {
        gap: 8px;
    }
    
    .wcc-filter-field label {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .wcc-filter-select,
    .wcc-filter-field input[type="number"] {
        padding: clamp(5px, 1.5vw, 7px) clamp(7px, 1.5vw, 10px);
        font-size: 12px;
    }
    
    /* Stack range inputs vertically on tablet */
    .wcc-range-inputs {
        flex-direction: column;
        gap: 6px;
    }
    
    .wcc-range-separator {
        display: none;
    }
}

/* Small Laptop/Tablet (1024px - 1279px) - Remove padding */
@media (min-width: 1024px) and (max-width: 1279px) {
    .wcc-sidebar-filter-wrapper {
        padding: 0;
        margin-bottom: 1.5rem;
    }
    
    .wcc-sidebar-filter-wrapper h3 {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
        padding-left: 0;
        line-height: 1.2;
    }
    
    .wcc-filter-container {
        margin: 0;
        padding: 0;
    }
    
    .wcc-filter-form {
        gap: 6px;
        margin: 0;
        padding: 0;
    }
    
    .wcc-filter-field {
        display: flex;
        flex-direction: column;
        min-width: 0;
        gap: 2px;
    }
    
    .wcc-filter-field label {
        font-size: 10px;
        margin-bottom: 0;
        padding: 0;
        line-height: 1.1;
    }
    
    .wcc-filter-select,
    .wcc-filter-field input[type="number"] {
        padding: 4px 6px;
        font-size: 11px;
        line-height: 1.2;
        height: auto;
    }
    
    .wcc-range-inputs {
        gap: 3px;
        margin: 0;
        padding: 0;
    }
    
    .wcc-range-inputs input {
        flex: 1;
        min-width: 0;
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .wcc-range-separator {
        display: inline;
        font-size: 10px;
        flex: 0 0 auto;
        padding: 0 2px;
    }
    
    .wcc-filter-actions {
        display: flex;
        gap: 6px;
        align-items: center;
        grid-column: 1 / -1;
        margin-top: 4px;
        padding: 0;
        flex-wrap: wrap;
    }
    
    .wcc-btn {
        padding: 6px 10px;
        border: none;
        border-radius: 3px;
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }
    
    .wcc-btn-primary {
        background: #a46497;
        color: #fff;
    }
    
    .wcc-btn-primary:hover {
        background: #935386;
    }
    
    .wcc-btn-secondary {
        background: #f7f7f7;
        color: #515151;
        border: 1px solid #e5e5e5;
        flex: 0.8;
    }
    
    .wcc-btn-secondary:hover {
        background: #ececec;
    }
    
    .wcc-btn img {
        width: 12px !important;
        height: 12px !important;
    }
}

/* Medium Laptop (1280px - 1536px) - Tight padding */
@media (min-width: 1280px) and (max-width: 1536px) {
    .wcc-sidebar-filter-wrapper {
        padding: 0;
        margin-bottom: 1.5rem;
    }
    
    .wcc-sidebar-filter-wrapper h3 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
        padding-left: 0;
        line-height: 1.2;
    }
    
    .wcc-filter-container {
        margin: 0;
        padding: 0;
    }
    
    .wcc-filter-form {
        gap: 8px;
        margin: 0;
        padding: 0;
    }
    
    .wcc-filter-field {
        display: flex;
        flex-direction: column;
        min-width: 0;
        gap: 3px;
    }
    
    .wcc-filter-field label {
        font-size: 11px;
        margin-bottom: 0;
        padding: 0;
        line-height: 1.2;
    }
    
    .wcc-filter-select,
    .wcc-filter-field input[type="number"] {
        padding: 5px 8px;
        font-size: 12px;
        line-height: 1.3;
        height: auto;
    }
    
    .wcc-range-inputs {
        gap: 4px;
        margin: 0;
        padding: 0;
    }
    
    .wcc-range-inputs input {
        flex: 1;
        min-width: 0;
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .wcc-range-separator {
        display: inline;
        font-size: 11px;
        flex: 0 0 auto;
        padding: 0 3px;
    }
    
    .wcc-filter-actions {
        display: flex;
        gap: 8px;
        align-items: center;
        grid-column: 1 / -1;
        margin-top: 6px;
        padding: 0;
        flex-wrap: wrap;
    }
    
    .wcc-btn {
        padding: 7px 12px;
        border: none;
        border-radius: 3px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex: 1;
        min-width: 85px;
        justify-content: center;
    }
    
    .wcc-btn-primary {
        background: #a46497;
        color: #fff;
    }
    
    .wcc-btn-primary:hover {
        background: #935386;
    }
    
    .wcc-btn-secondary {
        background: #f7f7f7;
        color: #515151;
        border: 1px solid #e5e5e5;
        flex: 0.8;
    }
    
    .wcc-btn-secondary:hover {
        background: #ececec;
    }
    
    .wcc-btn img {
        width: 13px !important;
        height: 13px !important;
    }
}

/* Desktop responsive (1024px+) */
@media (min-width: 1024px) {
    .wcc-filter-form {
        gap: 10px;
    }
    
    .wcc-filter-field label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .wcc-filter-select,
    .wcc-filter-field input[type="number"] {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Keep range inputs horizontal on desktop */
    .wcc-range-inputs {
        flex-direction: row;
        gap: 8px;
    }
    
    .wcc-range-separator {
        display: inline;
        font-size: 14px;
    }
}
