/**
 * Custom Select Dropdown Styles
 * Mimics a select dropdown with image backgrounds
 */

/* CRITICAL: Hide old system elements immediately to prevent flash */
#variationChangerConHOLDER,
#variationChangerCon,
#variationChangerCon2,
#variationChangerCon3,
#variationChangerCon4,
.dropdownVV,
.dropbtn,
.dropdown-content,
.variationBtns {
    display: none !important;
    visibility: hidden !important;
}

/* Hide original variation selects by default - custom dropdowns will show */
.component select,
.component_options select,
table.variations select {
    display: none !important;
}

/*steady custom*/

table.variations tbody {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 10px;
}
.attribute_options label {
    display: inline-block;
    margin-bottom: .5rem;
    top: 7px;
    position: relative;
}
@media (max-width: 767px) {
    tr.attribute_options:not([data-attribute_label="single"]):not([data-attribute_label="camo"]):not([data-attribute_label="multi"]) {
        display: block !important;
        width: 100% !important;
        justify-content: center;
    }
}

html tr.attribute_options .label {
     display: block !important; 
}

@media (max-width: 768px) {
    .custom-select-modal .custom-select-option {
        padding: 12px 15px;
        border-bottom: 1px solid #000000;
        font-size: 15px;
        cursor: pointer;
        transition: background 0.2s ease;
        background-position: left !important;
        background-repeat: no-repeat !important;
        background-size: contain !important;
        opacity: 1;
    }
	
	.custom-select-modal .option-content {
        min-height: 40px;
        padding: 8px 15px;
        text-align: end;
        font-weight: 800 !important;
    }
	
.details.component_data	table.variations {
    max-height: fit-content;
    margin-bottom: 46px !important;
    margin-top: -52px !important;
}
}



/* CRITICAL: Ensure parent containers don't hide dropdowns */
.component-dropdowns-container,
.custom-select-wrapper,
.custom-select-dropdown,
.composite_wrap,
.component,
.component_options {
    overflow: visible !important;
}

/* Hide original variation tables when custom dropdown is present */
.custom-select-dropdown + table.variations,
table.variations:has(+ .custom-select-dropdown) {
    display: none !important;
}

/* Also hide any original select that has been enhanced */
select[data-custom-select-initialized="true"] {
    display: none !important;
}

/* Hide parent rows of enhanced selects */
select[data-custom-select-initialized="true"]:parent,
tr:has(select[data-custom-select-initialized="true"]) {
    display: none !important;
}

/* Main container for all dropdowns in a component */
.component-dropdowns-container {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.component-dropdowns-container.component-slide {
    border-color: #4a90e2;
    background: linear-gradient(to bottom, #ffffff 0%, #f0f7ff 100%);
}

.component-dropdowns-container.component-frame {
    border-color: #7cb342;
    background: linear-gradient(to bottom, #ffffff 0%, #f1f8e9 100%);
}

.component-dropdowns-container.component-magwell {
    border-color: #ff7043;
    background: linear-gradient(to bottom, #ffffff 0%, #fff3e0 100%);
}

/* Component title */
.component-title {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #333;
}

/* Wrapper container for each dropdown */
.custom-select-wrapper {
    margin-bottom: 10px;
    /* Don't hide overflow so dropdown can show */
    overflow: visible !important;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Clear/Reset button styling (matches WooCommerce) */
.custom-select-wrapper .reset_variations {
    text-decoration: none;
    color: #a00;
    font-size: 20px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    padding: 0 5px;
    transition: all 0.2s ease;
}

.custom-select-wrapper .reset_variations:hover {
    color: #f00;
    transform: scale(1.2);
}

/* Display dropdowns side by side on all screen sizes */
.component-dropdowns-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
}

.component-dropdowns-container .component-title {
    width: 100%;
}

.component-dropdowns-container .custom-select-wrapper {
    flex: 1;
    min-width: 140px;
}

@media (max-width: 480px) {
    .component-dropdowns-container .custom-select-wrapper {
        min-width: calc(50% - 8px);
    }
}

/* Component-specific styling */
.custom-select-wrapper.component-slide {
    background: linear-gradient(135deg, #f0f0f0 0%, #fff 100%);
}

.custom-select-wrapper.component-frame {
    background: linear-gradient(135deg, #e8e8e8 0%, #fff 100%);
}

.custom-select-wrapper.component-magwell {
    background: linear-gradient(135deg, #f5f5f5 0%, #fff 100%);
}

/* Type-specific styling */
.custom-select-wrapper.type-single {
    border-left: 4px solid #333;
}

.custom-select-wrapper.type-camo {
    border-left: 4px solid #7a6e3d;
}

/* Label styling */
.custom-select-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

.custom-select-wrapper.type-single .custom-select-label {
    color: #333;
}

.custom-select-wrapper.type-camo .custom-select-label {
    color: #7a6e3d;
}

/* Main dropdown container */
.custom-select-dropdown {
    position: relative !important;
    display: inline-block;
    width: 100%;
    max-width: 400px;
    font-family: inherit;
    /* Don't hide overflow so dropdown can show */
    overflow: visible !important;
    z-index: 1000;
}

/* Selected value display (closed state) - styled like native select */
.custom-select-selected {
    position: relative;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    line-height: 1.42857143;
}

.custom-select-selected:hover {
    border-color: #999;
}

.custom-select-dropdown.open .custom-select-selected {
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
}

/* Dropdown arrow - styled like native select */
.dropdown-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 10px;
    transition: transform 0.2s ease;
    pointer-events: none;
    z-index: 10;
    /* Triangle arrow like native select */
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #fff;
}

.custom-select-dropdown.open .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* Options container (dropdown list) - styled like native select */
.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 99999;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Force show options when dropdown is open */
.custom-select-dropdown.open .custom-select-options {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Individual option */
.custom-select-option {
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #eee;
}

.custom-select-option:last-child {
    border-bottom: none;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
}

.custom-select-option:hover {
    background: rgba(250, 241, 0, 0.1);
}

.custom-select-option.selected {
    background: rgba(250, 241, 0, 0.2);
}

/* Option content with background image - styled like native select options */
.option-content {
    /*
    padding: 6px 12px;
    padding-right: 30px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    min-height: 24px;
    display: flex;
    align-items: center;
    font-size: 14px;
    line-height: 1.42857143;
    */
    color: white;
    padding: 16px;
    padding-right: 35px; /* Make room for arrow */
    font-size: 16px;
    border: none;
    cursor: pointer;
    position: relative;
    /* left: -62px; */
    /* width: 165%; */
    z-index: 1;
    background-color: #000 !important;

    background-repeat: no-repeat;
    background-position: left;
    text-align: end;
    width: 100%;

}

/* Add overlay for better text readability */
.option-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
	/*
    background: linear-gradient(to right,
        rgba(255,255,255,0.95) 0%,
        rgba(255,255,255,0.85) 60%,
        rgba(255,255,255,0.3) 100%);
	*/
    pointer-events: none;
}

/* Option text */
.option-text {
    position: relative;
    z-index: 1;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    text-transform: capitalize;
  /*  text-shadow: 1px 1px 2px rgba(255,255,255,0.8); */
	text-align: right !important;
    color: #fff !important;
}

.custom-select-option:hover .option-text {
    color: #000;
}

.custom-select-option.selected .option-text {
    color: #6a6820;
    font-weight: 700;
}

/* Scrollbar styling */
.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .custom-select-dropdown {
        max-width: 100%;
    }

    .custom-select-options {
        max-height: 200px;
    }

    .option-text {
        font-size: 13px;
    }

    /* Mobile modal styles */
    .custom-select-modal {
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            transform: translate(-50%, 100%);
            opacity: 0;
        }
        to {
            transform: translate(-50%, -50%);
            opacity: 1;
        }
    }

    .custom-select-modal .custom-select-options {
        position: relative !important;
        top: auto !important;
        max-height: none !important;
        border: none !important;
        box-shadow: none !important;
        display: block !important;
    }

    .custom-select-modal .custom-select-option {
        padding: 12px 15px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 15px;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .custom-select-modal .custom-select-option:hover {
        background: rgba(250, 241, 0, 0.1);
    }

    .custom-select-modal .custom-select-option:last-child {
        border-bottom: none;
    }

    .custom-select-modal .option-content {
        min-height: 40px;
        padding: 8px 15px;
    }

    .custom-select-modal .option-text {
        font-size: 15px;
        font-weight: 500;
    }

    /* Overlay animation */
    .custom-select-overlay {
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    /* Prevent body scroll when modal is open */
    body.modal-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* Loading state */
.custom-select-dropdown.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Disabled state */
.custom-select-dropdown.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.custom-select-dropdown.disabled .custom-select-selected {
    cursor: not-allowed;
    background: #f5f5f5;
}