/**
 * UruShop Composite Swatches
 *
 * Reskins WooCommerce Composite Products' progressive thumbnail UI
 * into compact visual swatches. All components visible at once.
 *
 * @see mu-plugins/specs/urushop-composite-swatches.spec.md
 */

/* ==========================================================================
   1. Force All Components Open (override progressive accordion)
   ========================================================================== */

/* Show all component inner content */
.composite_form.progressive .composite_component .component_inner {
    display: block !important;
}

/* Remove blocked/closed visual states */
.composite_form.progressive .composite_component.blocked,
.composite_form.progressive .composite_component.closed {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Remove transition flicker when CP toggles classes */
.composite_form.progressive .composite_component {
    transition: none !important;
}

/* ==========================================================================
   2. Component Spacing & Layout
   ========================================================================== */

.composite_form.progressive .composite_component {
    margin-bottom: 2px;
    padding-bottom: 0;
    border-bottom: none;
}

.composite_form.progressive .composite_component:last-of-type {
    margin-bottom: 0;
}

/* Kill CP's generous inner padding (default ~48px) */
.composite_form.progressive .composite_component .component_inner {
    padding: 0 !important;
}

/* ==========================================================================
   3. Component Title — clean row header, no step numbers or toggle
   ========================================================================== */

/* Remove toggle button */
.composite_form.progressive .component_title_button,
.composite_form.progressive .step_title_wrapper button {
    display: none !important;
}

/* Remove step index number */
.composite_form.progressive .step_title_wrapper .step_index {
    display: none !important;
}

/* Hide the accessibility-only title duplicate */
.composite_form.progressive .step_title_wrapper .aria_title {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    clip: rect(0, 0, 0, 0) !important;
    overflow: hidden !important;
}

/* Force the step title text visible (CP hides it in progressive mode) */
.composite_form.progressive .step_title_wrapper .step_title {
    display: inline !important;
}

/* Style the title wrapper as a compact label */
.composite_form.progressive .component_title_wrapper {
    padding: 4px 0 3px;
    margin: 0;
}

.composite_form.progressive .step_title_wrapper {
    display: block !important;
    width: 100% !important;
    padding: 0;
    margin: 0;
    cursor: default !important;
    border: none !important;
    background: none !important;
    /* Kill any CP toggle arrow (background-image, ::before, ::after) */
    background-image: none !important;
}

.composite_form.progressive .step_title_wrapper::before,
.composite_form.progressive .step_title_wrapper::after,
.composite_form.progressive .step_title_wrapper h2::before,
.composite_form.progressive .step_title_wrapper h2::after,
.composite_form.progressive .component_title_text::before,
.composite_form.progressive .component_title_text::after {
    display: none !important;
    content: none !important;
}

.composite_form.progressive .step_title_wrapper h2,
.composite_form.progressive .step_title_wrapper.component_title {
    font-family: var(--urushop-font-body, 'Inter', sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--urushop-charcoal, #2D3436);
    line-height: 1.2;
    margin: 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block !important;
    width: 100% !important;
    background-image: none !important;
}

/* ==========================================================================
   4. Thumbnails → Compact Swatches
   ========================================================================== */

/* Container: horizontal flex row */
.composite_form.progressive .component_option_thumbnails_container {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Each thumbnail item: auto-sized */
.composite_form.progressive .component_option_thumbnail_container {
    width: auto !important;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

/* The clickable thumbnail — 64px swatch */
.composite_form.progressive .component_option_thumbnail {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 2px solid #E0E0E0;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    padding: 3px;
    box-sizing: border-box;
    background: #fff;
}

/* Image inside: fill the swatch */
.composite_form.progressive .component_option_thumbnail .thumbnail_image {
    width: 100% !important;
    height: 100% !important;
}

.composite_form.progressive .component_option_thumbnail .thumbnail_image a {
    display: block;
    width: 100%;
    height: 100%;
}

.composite_form.progressive .component_option_thumbnail .thumbnail_image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    border-radius: 5px;
}

/* ==========================================================================
   5. Hide Text, Price, and Buttons Inside Thumbnails
   ========================================================================== */

.composite_form.progressive .component_option_thumbnail .thumbnail_description {
    display: none !important;
}

.composite_form.progressive .component_option_thumbnail .thumbnail_buttons {
    display: none !important;
}

/* ==========================================================================
   6. Selected State — Green Ring
   ========================================================================== */

.composite_form.progressive .component_option_thumbnail.selected {
    border-color: var(--urushop-mate-green, #00A86B);
    box-shadow: 0 0 0 2px var(--urushop-mate-green, #00A86B);
}

/* Hover state */
.composite_form.progressive .component_option_thumbnail:hover:not(.selected) {
    border-color: var(--urushop-mate-green, #00A86B);
}

/* ==========================================================================
   7. Hide Component Content / Summary / Messages
   ========================================================================== */

/* Hide "In stock" text, product details, and selection messages */
.composite_form.progressive .component_content {
    display: none !important;
}

.composite_form.progressive .component_message.bottom {
    display: none !important;
}

/* Hide the "Available options:" label */
.composite_form.progressive .component_options_title,
.composite_form.progressive .component_section_title,
.composite_form.progressive .select_label {
    display: none !important;
}

/* Hide the component description */
.composite_form.progressive .component_description_wrapper {
    display: none !important;
}

/* Hide "block component" overlay */
.composite_form.progressive .block_component {
    display: none !important;
}

/* Hide the progressive navigation arrows (prev/next step buttons) */
.composite_form.progressive .page_button,
.composite_form.progressive .composite_navigation {
    display: none !important;
}

/* ==========================================================================
   8. Hide Pagination Controls
   ========================================================================== */

.composite_form.progressive .component_pagination,
.composite_form.progressive .component_option_pagination,
.composite_form.progressive .component_options_pagination {
    display: none !important;
}

/* ==========================================================================
   9. Keep Composite Summary / Review Section Visible
   ========================================================================== */

/* The overall composite summary (bottom section) should stay visible */
.composite_form.progressive .composite_summary {
    display: block;
}

/* ==========================================================================
   10. Gallery Overlay Fix — positioned container for scenario overlays
   ========================================================================== */

/* CP Conditional Images uses position:absolute overlays inside the gallery.
   The container must be position:relative for them to stack correctly. */
.product-type-composite .woocommerce-product-gallery__image {
    position: relative !important;
}

/* Overlay images must be transparent so all layers composite together.
   Without this, the theme's img { background: #fff } makes the top
   overlay opaque, hiding the cup and bombilla beneath the flask. */
.product-type-composite .wc-cp-overlay-image {
    background: transparent !important;
    background-color: transparent !important;
}

/* ==========================================================================
   11. Hide Duplicate Price Near Add-to-Cart Button
   ========================================================================== */

.composite_form.progressive .composite_price {
    display: none !important;
}

/* ==========================================================================
   11. Hide Quantity Selector (kit = buy one at a time)
   ========================================================================== */

.composite_form.progressive .composite_quantity {
    display: none !important;
}

/* Also target the WC quantity wrapper for composite products */
.product-type-composite .quantity.composite_quantity,
.product-type-composite form.cart .composite_button .quantity {
    display: none !important;
}

/* ==========================================================================
   12. Remove disabled state (CP blocks non-current step inputs)
   ========================================================================== */

.composite_form.progressive .composite_component.disabled {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ==========================================================================
   13. Prevent Flash of Accordion on Load (FOUC)
   ========================================================================== */

/* Hide component inner content until JS runs — prevents accordion flash.
   Our JS removes blocked/closed and forces display:block, so this
   only applies during the initial render before setup(). */
.composite_form.progressive .composite_component.blocked .component_inner,
.composite_form.progressive .composite_component.closed .component_inner {
    display: block !important;
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* Once our JS adds the 'urushop-swatches-ready' class, reveal smoothly */
.composite_form.progressive.urushop-swatches-ready .composite_component .component_inner {
    opacity: 1;
}

/* ==========================================================================
   14. Add-to-Cart Button + Wishlist — inline row
   ========================================================================== */

/* Button area: flex row with add-to-cart + wishlist side by side.
   JS moves .urushop-wishlist-btn into .composite_button so they're siblings. */
.composite_form.progressive .composite_button {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.product-type-composite .urushop-wishlist-btn {
    flex: 0 0 auto;
}

.product-type-composite .yith-wcwl-add-to-wishlist {
    display: inline-flex !important;
    align-items: center;
}

/* ==========================================================================
   15. Hide Frequently Bought Together on composite products
   ========================================================================== */

.product-type-composite .urushop-fbt {
    display: none !important;
}

/* ==========================================================================
   16. Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .composite_form.progressive .component_option_thumbnail {
        width: 56px;
        height: 56px;
        padding: 2px;
    }

    .composite_form.progressive .component_option_thumbnail .thumbnail_image img {
        border-radius: 4px;
    }

    .composite_form.progressive .component_option_thumbnails_container {
        gap: 6px;
    }
}
