/**
 * KS Shop Customizer - Frontend Styles (sidebar filter specific)
 *
 * @package KS_Shop_Customizer
 */

/* =====================================================
   SIDEBAR LAYOUT
   ===================================================== */
.kssc-sidebar {
    flex: 0 0 auto;
    width: 280px;
    min-width: 200px;
}

.kssc-sidebar-inner {
    position: sticky;
    top: 20px;
}

/* =====================================================
   FILTER SECTION (generic wrapper)
   ===================================================== */
.kssc-filter-section {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 16px;
    overflow: hidden;
}

.kssc-filter-title {
    font-size: 13px;
    font-weight: 600;
    padding: 12px 14px;
    margin: 0;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #f0f0f0;
}

.kssc-toggle-icon {
    font-size: 16px;
    line-height: 1;
    color: #999;
    transition: transform 0.2s ease;
}

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

.kssc-filter-body {
    padding: 10px 14px;
}

/* =====================================================
   CHECKBOX LABELS (category filter + status filter)
   ===================================================== */
.kssc-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    line-height: 1.3;
}

.kssc-checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #e74c3c;
    cursor: pointer;
}

.kssc-checkbox-text {
    flex: 1;
}

.kssc-sub-categories {
    margin-left: 22px;
}

.kssc-sub-cat .kssc-checkbox-text {
    font-size: 12px;
    color: #777;
}

/* =====================================================
   PRICE FILTER
   ===================================================== */
.kssc-price-range {
    padding: 4px 0;
}

.kssc-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.kssc-price-inputs input[type="number"] {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    text-align: center;
}

.kssc-price-separator {
    color: #999;
    flex-shrink: 0;
}

.kssc-price-slider-wrap {
    position: relative;
    height: 20px;
    margin-bottom: 8px;
}

.kssc-range-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    -webkit-appearance: none;
    pointer-events: none;
    top: 8px;
}

.kssc-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e74c3c;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.kssc-range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e74c3c;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid #fff;
}

.kssc-price-display {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.kssc-price-filter-btn {
    display: block;
    width: 100%;
    padding: 7px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kssc-price-filter-btn:hover {
    background: #e0e0e0;
}

/* =====================================================
   RESET BUTTON
   ===================================================== */
.kssc-filter-reset-wrap {
    border: none;
    background: transparent;
}

.kssc-filter-reset {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #777;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kssc-filter-reset:hover {
    background: #f8f8f8;
    color: #333;
    border-color: #ccc;
}

/* =====================================================
   RESULTS INFO
   ===================================================== */
.kssc-results-info {
    margin-bottom: 5px;
}

.kssc-results-count,
.kssc-results-count-toolbar {
    font-size: 13px;
    color: #777;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 991px) {
    .kssc-sidebar-inner {
        margin-bottom: 20px;
    }
}

/* Product image link */
.kssc-product-image-link {
    display: block;
}

/* =====================================================
   QUANTITY STEPPER (v1.3.0)
   Renders before CTA on grid view (inline row),
   stacks above CTA on list view.
   ===================================================== */
.kssc-qty-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-top: auto;
}

.kssc-qty-row .kssc-add-to-cart {
    margin-top: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.kssc-qty-wrapper {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #d0d0d0;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    flex: 0 0 auto;
    height: auto;
}

.kssc-qty-wrapper button.kssc-qty-minus,
.kssc-qty-wrapper button.kssc-qty-plus {
    width: 28px;
    min-width: 28px;
    padding: 0;
    background: #f5f5f5;
    border: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    text-shadow: none;
    border-radius: 0;
}

.kssc-qty-wrapper button.kssc-qty-minus:hover,
.kssc-qty-wrapper button.kssc-qty-plus:hover {
    background: #e8e8e8;
    color: #333;
}

.kssc-qty-wrapper button.kssc-qty-minus:focus,
.kssc-qty-wrapper button.kssc-qty-plus:focus {
    outline: none;
    background: #e8e8e8;
}

.kssc-qty-wrapper .kssc-qty-input {
    width: 36px;
    min-width: 36px;
    padding: 0 2px;
    border: 0;
    text-align: center;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    background: #fff;
    -moz-appearance: textfield;
    appearance: textfield;
    box-shadow: none;
    line-height: 1;
}

.kssc-qty-wrapper .kssc-qty-input::-webkit-outer-spin-button,
.kssc-qty-wrapper .kssc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.kssc-qty-wrapper .kssc-qty-input:focus {
    outline: none;
    background: #fafafa;
}

/* v1.3.1: list-view footer-bar replaces the old .kssc-list-actions column.
   Pris til venstre, stepper + CTA til højre, adskilt med top-border. */
.kssc-list-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

.kssc-list-footer-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kssc-list-footer-left .kssc-product-price {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.kssc-list-footer-left .kssc-price-amount {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.kssc-list-footer-left .kssc-tax-label {
    font-size: 11px;
    color: #888;
    font-weight: 400;
}

.kssc-list-footer-right {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-shrink: 0;
}

/* CTA inside footer-right keeps its standard size — no full-width stretch.
   Override the global .kssc-add-to-cart's margin-top: auto rule for this context. */
.kssc-list-footer-right .kssc-add-to-cart {
    margin-top: 0 !important;
    width: auto;
    padding: 8px 22px;
    white-space: nowrap;
}

/* Mobile: stack the footer bar vertically on narrow screens so price and actions
   each get full width. */
@media (max-width: 575px) {
    .kssc-list-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .kssc-list-footer-right {
        justify-content: space-between;
    }
    .kssc-list-footer-right .kssc-add-to-cart {
        flex: 1;
    }
}

/* Mobile: keep the inline row working even on narrow screens.
   At <380px the gap shrinks so both elements still fit. */
@media (max-width: 420px) {
    .kssc-qty-row {
        gap: 6px;
    }
    .kssc-qty-wrapper button.kssc-qty-minus,
    .kssc-qty-wrapper button.kssc-qty-plus {
        width: 26px;
        min-width: 26px;
    }
    .kssc-qty-wrapper .kssc-qty-input {
        width: 32px;
        min-width: 32px;
    }
}

/* =====================================================
   KS CATEGORY WIDGET
   Visual category cards — same design DNA as KS Mega Categories
   ===================================================== */
.kssc-cat-widget {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Remove padding from cards section filter-body */
.kssc-cat-cards-section .kssc-filter-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Single category card */
.kssc-cat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    text-decoration: none;
    color: #333;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    cursor: pointer;
    min-width: 0;
}

.kssc-cat-card:hover {
    background: #fafafa;
    color: #e85d04;
    border-color: #f0c0a0;
    transform: translateX(2px);
    text-decoration: none;
}

/* Active (current category) - matches PHP class kssc-cat-card-active */
.kssc-cat-card.kssc-cat-card-active {
    background: #fff4ef;
    color: #e85d04;
    border-color: #e85d04;
    font-weight: 600;
}

.kssc-cat-card.kssc-cat-card-active:hover {
    background: #ffede4;
}

/* Image box */
.kssc-cat-card-img {
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.kssc-cat-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.kssc-cat-card-img svg {
    color: #bbb;
}

/* Text area */
.kssc-cat-card-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kssc-cat-card-name {
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    color: inherit;
}

.kssc-cat-card-count {
    font-size: 10.5px;
    color: #aaa;
    display: block;
    line-height: 1;
}

.kssc-cat-card.kssc-cat-card-active .kssc-cat-card-count {
    color: #e8a07a;
}

.kssc-cat-card:hover .kssc-cat-card-count {
    color: #e8a07a;
}

/* Arrow */
.kssc-cat-card-arrow {
    font-size: 12px;
    color: #ccc;
    flex-shrink: 0;
    transition: color 0.15s ease, transform 0.15s ease;
}

.kssc-cat-card:hover .kssc-cat-card-arrow,
.kssc-cat-card.kssc-cat-card-active .kssc-cat-card-arrow {
    color: #e85d04;
    transform: translateX(2px);
}

/* Widget title (from theme's before_title/after_title) */
.kssc-cat-widget-wrap .widget-title,
.kssc-cat-widget-wrap h2.widget-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}

/* Mobile: hide images to save space */
@media (max-width: 480px) {
    .kssc-cat-card-img {
        display: none;
    }
}
