
/* Variable Product Layout */
.mytheme-variations-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.mytheme-variation-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mytheme-variation-row .label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: #0f172a;
}

.mytheme-variation-row .label-row .selected-value {
    font-weight: 400;
    margin-left: 8px;
    color: #6b7280;
}

/* Hide default selects but keep them accessible for JS logic */
.mytheme-hidden-select {
    display: none !important; 
    /* We use visibility:hidden or display:none depending on if WC needs them in layout. 
       Usually display:none is fine for selects if we manually trigger change events. */
}

/* Swatches Container */
.mytheme-swatches {
    display: flex;
    gap: 10px;
}

/* Color Swatches (Circles) */
.mytheme-swatch-btn.type-color {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    position: relative;
    padding: 0;
    transition: all 0.2s ease;
    box-shadow: 0 0 0 2px transparent;
}

.mytheme-swatch-btn.type-color:hover {
    transform: scale(1.1);
}

.mytheme-swatch-btn.type-color.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px #0f172a; /* Ring effect */
}

/* Size Buttons (Rectangles) */
.mytheme-swatch-btn.type-text {
    min-width: 48px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mytheme-swatch-btn.type-text:hover {
    border-color: #9ca3af;
}

.mytheme-swatch-btn.type-text.selected {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

/* Disabled state (if WC marks options as disabled via JS - we need to handle this in our JS) */
.mytheme-swatch-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
    background-color: #f9fafb;
    border-color: #e5e7eb;
    pointer-events: none; /* Prevent clicks */
}

/* Size Guide Button */
.size-guide-container {
    margin-top: 12px;
    border-top: 1px solid #f3f4f6;
    padding-top: 12px;
}

.btn-size-guide {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-size-guide:hover {
    color: #0f172a;
}

/* Screen reader text */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.single-product .main-image img.large {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    transition: opacity 0.2s ease-in-out;
}

/* Sticky Product Bar Wrapper */
.sticky-product-bar-wrapper {
    display: none;
}

/* Size Guide Modal */
.sg-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.sg-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    position: relative;
    max-width: 900px;
    max-height: 90vh;
    overflow: auto;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.sg-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f3f4f6;
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: background 0.2s;
}

.sg-close:hover {
    background: #e5e7eb;
}

.sg-img-desktop { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.sg-img-mobile { display: none; max-width: 100%; width: 100%; height: auto; margin: 0 auto; object-fit: contain; }

@media (max-width: 768px) {
    .sg-img-desktop { display: none; }
    .sg-img-mobile { display: block; }
    /* .sg-modal { width: auto !important; }  Removed to ensure full width overlay */
    .sg-content { padding: 15px; overflow-x: hidden; }
}

/* Mobile Sticky Bar */
.mobile-sticky-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
    z-index: 999;
    border-radius: 16px 16px 0 0;
    padding: 0 20px;
    box-sizing: border-box;
    transition: transform 0.3s ease;
}

.msb-handle-bar {
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.msb-handle-pill {
    width: 40px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 4px;
    transition: background 0.2s;
}

.msb-handle-bar:active .msb-handle-pill {
    background: #d1d5db;
}

.msb-content {
    padding-bottom: 20px;
}

.msb-collapsible {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-sticky-bar.expanded .msb-collapsible {
    max-height: 500px; /* Arbitrary large value */
    opacity: 1;
    margin-top: 12px;
}

/* Ensure Size Guide is visible */
.single-product .summary .size-guide-container,
.size-guide-container {
    display: block !important;
    margin-top: 12px;
    width: 100%;
}

.btn-size-guide {
    display: flex !important;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border: none;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    width: 100%;
    justify-content: center;
}

/* Size Guide inside Sticky Bar */
.mobile-sticky-bar .size-guide-container {
    display: block !important; /* Force show */
    margin-top: 8px;
    border-top: 0;
    padding-top: 0;
}
.mobile-sticky-bar .btn-size-guide {
    background: #f3f4f6;
    width: 100%;
    justify-content: center;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    margin-block: 10px;
}

@media (max-width: 768px) {
    .mobile-sticky-bar {
        display: block;
    }
    
    /* Hide original elements on mobile */
    .single-product .summary .variations_form,
    .single-product .summary .price,
    .single-product .summary .availability,
    .single-product .summary .pix-price,
    .single-product .summary .buy-now {
        display: none !important;
    }
    
    /* Allow sticky bar clones to display properly */
    .mobile-sticky-bar .mytheme-variation-row {
        margin-bottom: 8px;
        max-width: 180px;
    }
    
    .mobile-sticky-bar .label-row {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .mobile-sticky-bar .mytheme-swatches {
        gap: 8px;
    }
    
    .mobile-sticky-bar .mytheme-swatch-btn.type-color {
        width: 28px;
        height: 28px;
    }
    
    .mobile-sticky-bar .mytheme-swatch-btn.type-text {
        height: 32px;
        font-size: 12px;
        min-width: 36px;
        padding: 0 8px;
    }
    
    /* Mobile Sticky Bar - Image 2 Layout */
@media (max-width: 768px) {
    .mobile-sticky-bar {
        padding: 0 16px 16px;
        background: #fff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }
    
    .msb-handle-bar {
        height: 24px;
        margin-bottom: 4px;
    }

    .msb-grid-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* Header Row: Labels */
    .msb-header-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .msb-label-group {
        display: flex;
        gap: 60px; /* Adjust based on where swatches land */
    }

    .msb-label {
        font-size: 12px;
        font-weight: 800;
        text-transform: uppercase;
        color: #000;
    }
    
    /* Size Guide Link */
    .msb-guide-container .btn-size-guide {
        font-size: 12px;
        color: #6b7280;
        text-decoration: underline;
        padding: 0;
        margin: 0;
        background: none;
        width: auto;
    }
    .msb-guide-container .btn-size-guide svg { display: inline-block; width: 14px; height: 14px; margin-right: 4px; }

    /* Options Row: Swatches */
    .msb-options-row {
        display: flex;
        align-items: flex-start;
        gap: 24px; /* Gap between Color and Size groups */
    }

    .msb-options-row .mytheme-variation-row {
        margin: 0;
    }
    
    .msb-options-row .label-row { display: none; /* Hide original labels, we use header */ }

    /* Swatches Styling */
    .mobile-sticky-bar .mytheme-swatch-btn.type-color {
        width: 36px;
        height: 36px;
        border: 1px solid #e5e7eb;
    }
    .mobile-sticky-bar .mytheme-swatch-btn.type-color.selected {
        border: 2px solid #000;
        box-shadow: none;
    }

    .mobile-sticky-bar .mytheme-swatch-btn.type-text {
        height: 40px;
        min-width: 48px;
        border: 1px solid #e5e7eb;
        background: #fff;
        color: #000;
        font-weight: 600;
        border-radius: 8px;
    }
    .mobile-sticky-bar .mytheme-swatch-btn.type-text.selected {
        background: #fff;
        border: 2px solid #000;
    }

    /* Actions Row */
    .msb-actions-row {
        display: flex;
        gap: 12px;
        align-items: stretch;
        height: 48px;
    }

    .msb-qty-wrapper {
        width: 100px;
        flex-shrink: 0;
    }

    .msb-qty-wrapper .qty-control {
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        height: 100%;
    }
    
    .msb-qty-wrapper .qty-control button {
        background: #fff;
        font-size: 18px;
    }
    .msb-qty-wrapper .qty-control input {
        font-size: 16px;
    }

    .msb-buy-btn {
        flex: 1;
        background: #000;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 800;
        text-transform: uppercase;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        white-space: nowrap; /* Prevent breaking */
        overflow: hidden;    /* Contain content */
    }
    
    .msb-price-value {
        font-weight: 800;
        display: flex;       /* Better alignment inside btn */
        align-items: center;
    }
    
    /* Hide old price (strikethrough) inside button to save space if needed */
    .msb-price-value del {
        display: none;
    }
    
    /* Ensure body padding */
    body.single-product { padding-bottom: 200px; }
}
    
    /* Fix mobile rating position */
    .mobile-rating {
        margin-bottom: 12px;
    }
    
    /* Add padding to body to prevent content being hidden behind sticky bar */
    body.single-product {
        padding-bottom: 180px;
    }
    
    /* Hide Size Guide Link in sticky bar to save space */
    /*.mobile-sticky-bar .size-guide-container {
        display: none;
    }*/
}
