/* Custom Variant Dropdown - Enhanced Design */
/* Colors based on Rajbandhu Theme */
:root {
    --variant-border-color: #E5194A;
    /* Primary Orange */
    --variant-bg-color: #fff7f9;
    /* Light Orange Background */
    --variant-text-color: #0f172a;
    --variant-radio-color: #E5194A;
}

.custom-variant-container {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
    font-family: 'Inter', sans-serif;
    z-index: 50 !important;
}

.custom-variant-container.active-dropdown {
    z-index: 1001 !important;
}

/* Ensure parent containers allow dropdown to overflow - EXCEPT scroll containers */
.products-grid-6,
.collection-products-grid,
.new-arrivals-grid,
.section,
.container {
    overflow: visible !important;
}

/* For scroll containers, we need a different approach */
.most-popular-scroll-wrapper {
    position: relative;
    overflow: visible;
    /* Allow dropdown to escape */
}

.most-popular-scroll {
    overflow-x: auto;
    /* Keep horizontal scroll */
    overflow-y: visible;
    /* Allow dropdown to show vertically */
    padding-bottom: 20px;
    /* Extra space for dropdown */
}

/* The Display Box (Closed) */
.variant-display {
    width: 100%;
    padding: 2px 10px;
    border: 1px solid var(--variant-border-color);
    border-radius: 6px;
    background: var(--variant-bg-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--variant-text-color);
    font-weight: 600;
    transition: all 0.2s ease;
    height: 32px;
}

.variant-display:hover {
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.1);
}

.variant-display.active {
    border-bottom-left-radius: 6px;
    /* Keep rounded corners even when open */
    border-bottom-right-radius: 6px;
    margin-bottom: 0;
    /* Space between display and dropdown */
}

.variant-display .variant-selected-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
    color: #0f172a;
}

.variant-display .arrow-icon {
    color: #E5194A;
    /* Orange Arrow */
    font-size: 18px;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.variant-display.active .arrow-icon {
    transform: rotate(180deg);
}

/* The Dropdown List (Open) */
.variant-dropdown-list {
    position: absolute;
    top: calc(100% + 4px);
    /* Slightly below display */
    left: 0;
    width: 100%;
    background: transparent;
    /* Transparent container */
    border: none;
    box-shadow: none;
    z-index: 100;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    padding: 0 1px;
    /* Avoid scrollbar cutting border */
}

.variant-dropdown-list.show {
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* Gap between cards */
    animation: slideDown 0.2s ease-out;
}

/* Option Items as Cards */
/* Option Items as Cards */
.variant-option-item {
    padding: 5px 10px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    margin-bottom: 0;
}

.variant-option-item:hover {
    border-color: #E5194A;
    /* Light Orange on Hover */
    background-color: #fff;
}

.variant-option-item.selected {
    border-color: var(--variant-border-color);
    /* Primary Orange Selected */
    background-color: var(--variant-bg-color);
    /* Light Orange BG */
    border-width: 1px;
}

/* Top Row: Name + Radio */
.option-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.option-text {
    font-size: 14px;
    color: #0f172a;
    font-weight: 600;
}

/* Radio Button Design */
.option-radio {
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
    background: #fff;
}

.variant-option-item:hover .option-radio {
    border-color: #E5194A;
}

.variant-option-item.selected .option-radio {
    border-color: var(--variant-radio-color);
    background-color: #fff;
}

.variant-option-item.selected .option-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-48%, -54%);
    width: 8px;
    height: 8px;
    background: var(--variant-radio-color);
    border-radius: 50%;
}

/* Bottom Row: Discount + Prices */
.option-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 13px;
}

/* Text Only Discount (No Pill) */
.option-discount {
    color: #16a34a;
    /* Green */
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.option-price-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Price Styles */
.option-price-current {
    color: #E5194A;
    /* Primary Orange */
    font-weight: 700;
    font-size: 13px;
}

.option-price-original {
    color: #94a3b8;
    /* Slate 400 */
    text-decoration: line-through;
    font-size: 13px;
}

.spacer {
    display: inline-block;
    width: 1px;
}

/* Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
.variant-dropdown-list::-webkit-scrollbar {
    width: 4px;
}

.variant-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

.variant-dropdown-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* Responsive Overrides */
@media (max-width: 480px) {
    .variant-display {
        padding: 8px 12px;
        font-size: 13px;
    }

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

    /* Mobile: Show 2 cards in popular section */
    .popular-card {
        min-width: calc(50% - 8px) !important;
        flex: 0 0 calc(50% - 8px) !important;
    }

    .most-popular-scroll {
        display: flex;
        gap: 16px;
        scroll-snap-type: x mandatory;
    }

    .popular-card {
        scroll-snap-align: start;
    }
}

@media (min-width: 481px) and (max-width: 768px) {

    /* Tablet: Show 3 cards */
    .popular-card {
        min-width: calc(33.333% - 12px) !important;
        flex: 0 0 calc(33.333% - 12px) !important;
    }
}