/**
 * Dos Soles - Luxury Coloration Shade Selector Component
 * Styles for PDP variation selector replacing clunky swatch grids.
 */

.ds-shade-selector-wrapper {
    position: relative;
    margin: 16px 0 20px 0;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    width: 100%;
    max-width: 100%;
}

.ds-shade-selector-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1a202c;
    margin-bottom: 8px;
}

.ds-shade-selector-label .ds-shade-count-badge {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 12px;
    margin-left: 6px;
    text-transform: none;
    letter-spacing: normal;
}

/* Trigger Button */
.ds-shade-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    user-select: none;
    outline: none;
}

.ds-shade-trigger:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.ds-shade-trigger:focus,
.ds-shade-trigger.is-open {
    border-color: #e26a2c;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(226, 106, 44, 0.15);
}

.ds-shade-trigger-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.ds-shade-placeholder {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.ds-selected-shade {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.ds-selected-thumb,
.ds-shade-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    flex-shrink: 0;
}

.ds-swatch-empty {
    display: inline-block;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: linear-gradient(135deg, #cbd5e1 25%, #e2e8f0 25%, #e2e8f0 50%, #cbd5e1 50%, #cbd5e1 75%, #e2e8f0 75%);
    background-size: 8px 8px;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
}

.ds-selected-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.ds-selected-code-name {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-selected-code {
    font-weight: 800;
    font-size: 14px;
    color: #0f172a;
    letter-spacing: 0.02em;
}

.ds-selected-name {
    font-size: 13.5px;
    color: #475569;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-selected-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding-left: 8px;
    flex-shrink: 0;
}

.ds-selected-price {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.ds-shade-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    margin-left: 8px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.ds-shade-trigger.is-open .ds-shade-chevron {
    transform: rotate(180deg);
    color: #e26a2c;
}

/* Dropdown Panel */
.ds-shade-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 1050;
    overflow: hidden;
    animation: dsFadeSlideDown 0.18s ease-out;
}

@keyframes dsFadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Bar */
.ds-shade-search-wrap {
    position: relative;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-search-icon {
    position: absolute;
    left: 22px;
    pointer-events: none;
    color: #94a3b8;
}

.ds-shade-search {
    width: 100%;
    height: 38px;
    padding: 6px 34px 6px 34px !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 13.5px !important;
    font-family: inherit !important;
    color: #1e293b !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: all 0.15s ease !important;
    margin: 0 !important;
}

.ds-shade-search:focus {
    border-color: #e26a2c !important;
    box-shadow: 0 0 0 2px rgba(226, 106, 44, 0.15) !important;
}

.ds-search-clear {
    position: absolute;
    right: 20px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    outline: none;
}

.ds-search-clear:hover {
    color: #334155;
}

/* List Items Container */
.ds-shade-list-scroll {
    max-height: 340px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.ds-shade-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.ds-shade-list-scroll::-webkit-scrollbar-track {
    background: #f8fafc;
}

.ds-shade-list-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.ds-shade-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ds-shade-item {
    display: flex !important;
    align-items: center !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    cursor: pointer !important;
    transition: background-color 0.12s ease !important;
    gap: 12px !important;
    user-select: none !important;
}

.ds-shade-item:last-child {
    border-bottom: none !important;
}

.ds-shade-item:hover {
    background-color: #f8fafc !important;
}

.ds-shade-item.is-selected {
    background-color: #fff7ed !important;
    border-left: 3px solid #e26a2c !important;
    padding-left: 11px !important;
}

.ds-shade-item.is-out-of-stock {
    opacity: 0.6;
}

.ds-shade-item.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

/* Item Columns */
.ds-shade-col-thumb {
    flex-shrink: 0;
}

.ds-shade-col-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.ds-shade-code-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-shade-code {
    font-weight: 700;
    font-size: 13.5px;
    color: #0f172a;
    letter-spacing: 0.02em;
}

.ds-shade-name {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-shade-col-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 8px;
}

.ds-shade-price {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
}

.ds-stock-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 12px;
    white-space: nowrap;
    line-height: 1.3;
}

.ds-stock-badge.in-stock {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.ds-stock-badge.out-of-stock {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* No Results Message */
.ds-shade-no-results {
    padding: 24px 16px;
    text-align: center;
    color: #64748b;
    font-size: 13.5px;
}

/* Hiding default swatch squares and native variations table for coloration lines */
.ds-has-coloration-selector .variable-items-wrapper,
.ds-has-coloration-selector ul.wvs-style-squared,
.ds-has-coloration-selector .woo-variation-swatches-variable-items-wrapper,
.ds-has-coloration-selector table.variations {
    display: none !important;
}

/* Ensure reset variation link remains cleanly placed if present */
.ds-has-coloration-selector .reset_variations {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
    text-decoration: underline;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .ds-shade-trigger {
        padding: 8px 12px;
        min-height: 48px;
    }

    .ds-selected-code {
        font-size: 13.5px;
    }

    .ds-selected-name {
        font-size: 12.5px;
    }

    .ds-selected-price {
        font-size: 13px;
    }

    .ds-shade-dropdown {
        position: absolute;
        max-height: 320px;
    }

    .ds-shade-list-scroll {
        max-height: 250px;
    }

    .ds-shade-item {
        padding: 9px 12px !important;
    }
}
