/* Zizania - Filter Sidebar (reusable) */
/* Styles WooCommerce Filter blocks + Tag Cloud in sidebar */

/* Sidebar wrapper */
#secondary.widget-area {
    padding: 0 1rem 0 0;
}

/* Hide the main "Filters" heading - redundant */
.wp-block-woocommerce-product-filters > .wp-block-heading:first-child {
    display: none;
}

/* Section headings - uppercase labels */
#secondary .wp-block-heading,
#secondary .widget-title,
#secondary .widgettitle {
    margin: 0 0 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--on-surface);
    line-height: 1.3;
}

/* Section spacing */
#secondary .wp-block-group,
#secondary .widget,
#secondary .wp-block-woocommerce-product-filter-taxonomy,
#secondary .wp-block-woocommerce-product-filter-price {
    margin-bottom: 2.5rem;
}

/* Checkbox list items */
.wc-block-product-filter-checkbox-list__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wc-block-product-filter-checkbox-list__item {
    margin-bottom: 0.625rem;
    list-style: none;
}

/* Checkbox label - flex row with text */
.wc-block-product-filter-checkbox-list__label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--on-surface);
    line-height: 1.4;
}

/* Custom checkbox - hide native, style span */
.wc-block-product-filter-checkbox-list__input {
    appearance: none;
    -webkit-appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid var(--outline-variant, #c9c7b2);
    border-radius: var(--radius-md);
    background-color: var(--surface-container-lowest, #fff);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 200ms ease;
    margin: 0;
}

/* Checked state - lime fill with checkmark */
#secondary input.wc-block-product-filter-checkbox-list__input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231d1b17' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8l3 3 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.75rem;
}


.wc-block-product-filter-checkbox-list__input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Tag Cloud as pill buttons */
#secondary .wp-block-tag-cloud,
#secondary .tagcloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

/* Individual pill */
#secondary .tag-cloud-link {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    background-color: #ede6dc;
    color: var(--on-surface);
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 0.8125rem !important;
    font-weight: 500;
    line-height: 1.2;
    transition: all 200ms ease;
    border: 1px solid transparent;
}

#secondary .tag-cloud-link:hover,
#secondary .tag-cloud-link:focus-visible {
    background-color: var(--primary);
    color: var(--on-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Hide tag counts if present - cleaner look */
#secondary .tag-cloud-link .tag-link-count {
    opacity: 1;
    color: var(--muted, #5f5b54);
    margin-left: 0.25rem;
    font-size: 0.75rem;
}

/* Price filter - style the input boxes */
.wc-block-product-filter-price .wc-block-components-price-slider__amount {
    background-color: var(--surface-container-lowest, #fff);
    border: none;
    box-shadow: 0 2px 6px rgba(var(--on-surface-rgb), 0.08);
    border-radius: var(--radius-md);
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--on-surface);
}

/* Checkbox hover - light lime fill */
.wc-block-product-filter-checkbox-list__label:hover .wc-block-product-filter-checkbox-list__input,
.wc-block-product-filter-checkbox-list__input:hover {
    background-color: rgba(var(--primary-rgb), 0.25);
    border-color: var(--primary);
}

/* Label hover - subtle text color change */
.wc-block-product-filter-checkbox-list__label:hover {
    color: var(--tertiary);
}

/* Active filter chips container */
#secondary .wc-block-product-filter-removable-chips__items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

/* Individual chip */
#secondary .wc-block-product-filter-removable-chips__item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    background-color: rgba(var(--secondary-rgb), 0.2);
    color: var(--on-surface);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: 0 2px 6px rgba(var(--on-surface-rgb), 0.08);
}

/* Chip remove button */
#secondary .wc-block-product-filter-removable-chips__item button,
#secondary .wc-block-product-filter-removable-chips__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;
    transition: background-color 200ms ease;
}

#secondary .wc-block-product-filter-removable-chips__item button:hover {
    background-color: rgba(var(--secondary-rgb), 0.35);
}

/* ─── Price Slider ─── */
#secondary .wc-block-product-filter-price-slider__range {
    flex-basis: 100%;
    position: relative;
    height: 1.5rem;
    margin: 0 0 1rem;
}

/* Track bar (background) */
#secondary .wc-block-product-filter-price-slider__range .range-bar {
    background-image: linear-gradient(to right, transparent 0%, var(--primary) 0px, var(--primary) 100%, transparent 0px) !important;
    z-index: 1;
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--primary);
    border-radius: var(--radius-full);
    transform: translateY(-50%);
}

/* Range inputs (thumb controls) - reset native look */
#secondary .wc-block-product-filter-price-slider__range input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    margin: 0;
}

/* Thumbs - WebKit */
#secondary .wc-block-product-filter-price-slider__range input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background-color: var(--primary);
    border: none;
    box-shadow: 0 2px 8px rgba(var(--on-surface-rgb), 0.15);
    cursor: grab;
    pointer-events: auto;
    transition: transform 150ms ease;
}

#secondary .wc-block-product-filter-price-slider__range input[type="range"]::-webkit-slider-thumb:hover,
#secondary .wc-block-product-filter-price-slider__range input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

/* Thumbs - Firefox */
#secondary .wc-block-product-filter-price-slider__range input[type="range"]::-moz-range-thumb {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background-color: var(--primary);
    border: none;
    box-shadow: 0 2px 8px rgba(var(--on-surface-rgb), 0.15);
    cursor: grab;
    pointer-events: auto;
}

/* Price input boxes layout (min on left, max on right) */
#secondary .wc-block-product-filter-price-slider__content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
}

#secondary .wc-block-product-filter-price-slider__left,
#secondary .wc-block-product-filter-price-slider__right {
    flex: 0 0 auto;
}

/* Price text inputs (min/max labels) */
#secondary .wc-block-product-filter-price-slider input[type="text"] {
    width: 4rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--surface-container-lowest, #fff);
    border: none;
    box-shadow: 0 2px 6px rgba(var(--on-surface-rgb), 0.08);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--on-surface);
    text-align: center;
}

#secondary .wc-block-product-filter-price-slider input[type="text"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary);
    background-color: #fff;
}

/* Hide native range tracks (we show our own via .range-bar) */
#secondary .wc-block-product-filter-price-slider__range input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
    border: none;
}

#secondary .wc-block-product-filter-price-slider__range input[type="range"]::-moz-range-track {
    background: transparent;
    border: none;
}


/* Unselected track background (behind .range-bar) */
#secondary .wc-block-product-filter-price-slider__range::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background-color: #ede6dc;
    border-radius: var(--radius-full);
    transform: translateY(-50%);
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   Clear filters — minimal text link with icon
   Replaces the default WC pill button
   ═══════════════════════════════════════════ */

/* Reset wrapper defaults */
#secondary .wp-block-woocommerce-product-filter-clear-button,
#secondary .wp-block-woocommerce-product-filter-clear-button .wp-block-button,
#secondary .wp-block-woocommerce-product-filter-clear-button .wp-block-button.is-style-outline {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    display: flex;
    justify-content: flex-start;
}

/* The button itself — text link with icon */
#secondary .wc-block-product-filter-clear-button .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    width: auto;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
    background: transparent !important;
    color: var(--on-surface);
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.2;
    cursor: pointer;
    transition: color 200ms ease;
}

/* Circular-arrow icon (refresh/undo glyph) before text */
#secondary .wc-block-product-filter-clear-button .wp-block-button__link::before {
    content: "";
    display: inline-block;
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 5V2L7 6l5 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8zm-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 5V2L7 6l5 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8zm-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-size: contain;
            mask-size: contain;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Hover — color change, icon spins, subtle underline */
#secondary .wc-block-product-filter-clear-button .wp-block-button__link:hover,
#secondary .wc-block-product-filter-clear-button .wp-block-button__link:focus-visible {
    color: var(--tertiary, #606200);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    background: transparent !important;
    box-shadow: none !important;
}

#secondary .wc-block-product-filter-clear-button .wp-block-button__link:hover::before,
#secondary .wc-block-product-filter-clear-button .wp-block-button__link:focus-visible::before {
    transform: rotate(-180deg);
}

/* Focus ring for keyboard users */
#secondary .wc-block-product-filter-clear-button .wp-block-button__link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 2px;
}
/* Remove WooCommerce block default border on chips */
#secondary .wc-block-product-filter-removable-chips__items .wc-block-product-filter-removable-chips__item {
    border: none;
}


/* ═══════════════════════════════════════════
   MOBILE DRAWER (<= 600px)
   WooCommerce native overlay, styled for Zizania
   ═══════════════════════════════════════════ */

/* Open drawer button (mobile only, hidden on desktop by core CSS) */
.wc-block-product-filters__open-overlay {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background-color: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
    transition: transform 200ms ease, box-shadow 200ms ease;
    margin-bottom: 1rem;
}

.wc-block-product-filters__open-overlay:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
}

.wc-block-product-filters__open-overlay svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* Overlay backdrop + dialog (mobile drawer only) */
@media (max-width: 600px) {
    .wc-block-product-filters__overlay-wrapper {
        background-color: rgba(var(--on-surface-rgb), 0.5);
    }

    .wc-block-product-filters__overlay-dialog {
        background-color: var(--surface, #FBF5EE);
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        padding: 1.5rem 1.25rem;
    }
}

/* Overlay header with close button */
.wc-block-product-filters__overlay-header {
    display: flex;
    justify-content: flex-end;
    padding: 0 0 0.5rem;
    border-bottom: 1px solid var(--outline-variant, #c9c7b2);
    margin-bottom: 1rem;
}

/* Close button (×) */
.wc-block-product-filters__close-overlay {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--on-surface);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 200ms ease;
}

.wc-block-product-filters__close-overlay:hover {
    background-color: rgba(var(--on-surface-rgb), 0.05);
}

.wc-block-product-filters__close-overlay svg {
    width: 1rem;
    height: 1rem;
}

/* Apply button (sticky at bottom of drawer) */
.wc-block-product-filters__apply {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background-color: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
    transition: transform 200ms ease;
    margin-top: 1.5rem;
}

.wc-block-product-filters__apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
}

/* Restore text for close button (WC uses span with text "Κλείσιμο") */
.wc-block-product-filters__close-overlay span {
    font-size: 0.875rem;
}


/* Mobile: put sidebar (open button) above main content */
@media (max-width: 921px) {
    /* Reset desktop grid & put filter button ABOVE products */
    .woocommerce.archive .ast-container {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none;
        gap: 0;
    }
    .woocommerce.archive #secondary.widget-area {
        order: -1;
        padding-right: 0 !important;
        margin-bottom: 1rem;
    }
    /* Hide Tag Cloud widget on mobile — keep sidebar minimal (just the filter button) */
    .woocommerce.archive #secondary .widget_tag_cloud {
        display: none;
    }
}

/* Mobile overlay fullscreen */
@media (max-width: 600px) {
    .wc-block-product-filters.is-overlay-opened .wc-block-product-filters__overlay {
        position: fixed;
        inset: 0;
        z-index: 10000;
    }
    .wc-block-product-filters.is-overlay-opened .wc-block-product-filters__overlay-dialog {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        overflow-y: auto;
    }
}

/* Hide close/apply buttons on desktop - only for mobile drawer */
@media (min-width: 601px) {
    .wc-block-product-filters__close-overlay,
    .wc-block-product-filters__overlay-header,
    .wc-block-product-filters__apply {
        display: none !important;
    }
}


/* ═══════════════════════════════════════════
   SIDEBAR WIDTH (desktop ≥ 922px)
   Compact width ώστε τα προϊόντα να
   έχουν περισσότερο χώρο
   ═══════════════════════════════════════════ */
@media (min-width: 922px) {
    .woocommerce.archive .ast-container {
        display: grid;
        grid-template-columns: 22% 1fr;
        gap: 2.5rem;
    }

    .woocommerce.archive #secondary.widget-area {
        width: 100%;
        max-width: none;
        padding-right: 0;
        border-right: none;
    }

    .woocommerce.archive #primary {
        width: 100%;
        max-width: none;
        padding-left: 0;
        border-left: none;
    }
}


/* ═══════════════════════════════════════════
   Category archive pages: hide the "Κατηγορία" filter section
   When user is already browsing a specific category, showing
   a single-option category filter is redundant and confusing.
   Applies only to /product-category/* (body.tax-product_cat).
   Shop page /shop/ still shows all category filters normally.
   ═══════════════════════════════════════════ */
.tax-product_cat #secondary .wp-block-woocommerce-product-filter-taxonomy {
    display: none;
}

/* === Sort dropdown ===*/
.woocommerce-ordering select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--surface-container-low, #f9f3ec);
    color: var(--on-surface, #1d1b17);
    border: 1.5px solid var(--outline-variant, #c9c7b2);
    border-radius: var(--radius-md, 0.75rem);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 2.5rem 0.5rem 0.875rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(29,58,36,0.06);
    min-width: 220px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.woocommerce-ordering select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2716%27 height=%2716%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%231D3A24%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpolyline points=%276 9 12 15 18 9%27/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
}
.woocommerce-ordering select:hover {
    border-color: var(--primary, #D6D964);
    box-shadow: 0 4px 12px rgba(142,213,225,0.2);
}
.woocommerce-ordering select:focus {
    outline: 2px solid var(--primary, #D6D964);
    outline-offset: 2px;
    border-color: var(--primary, #D6D964);
}
.woocommerce-ordering option {
    background-color: var(--surface-container-low, #f9f3ec);
    color: var(--on-surface, #1d1b17);
}

/* === Mobile shop background fix ===*/
@media (max-width: 600px) {
    body.woocommerce-page,
    body.woocommerce-shop {
        background-color: var(--surface, #FBF5EE);
    }
    .woocommerce-page .site-content,
    .woocommerce-shop .site-content,
    .woocommerce-page #page,
    .woocommerce-shop #page {
        background-color: var(--surface, #FBF5EE);
    }
}

/* Mobile sidebar background & filter block width fix */
@media (max-width: 921px) {
    .woocommerce.archive #secondary.widget-area {
        background-color: var(--surface, #FBF5EE) !important;
        border: none !important;
        box-shadow: none !important;
    }
    .wc-block-product-filters {
        display: block;
        width: 100%;
    }
}

/* === Mobile: force beige background on ALL content wrappers === */
@media (max-width: 921px) {
    body.woocommerce-page #page,
    body.woocommerce-page .hfeed,
    body.woocommerce-page .site-content,
    body.woocommerce-page .ast-container,
    body.woocommerce-page #primary,
    body.woocommerce-page #secondary,
    body.woocommerce-page .widget-area,
    body.woocommerce-page .sidebar-main {
        background-color: var(--surface, #FBF5EE) !important;
    }
}

/* WC filters overlay: hide when drawer is closed (prevents fixed full-screen overlay blocking content) */
@media (max-width: 921px) {
    .wc-block-product-filters:not(.is-overlay-opened) .wc-block-product-filters__overlay {
        display: none;
    }
}
