/**
 * Color Picker - Shared CSS Component
 * Used by: DTF, Embroidery, Screen Print Quote Builders
 *
 * Pattern: Compact list dropdown with 22-24px swatches
 * Update this file to change appearance across all quote builders
 */

/* =============================================
   COLOR PICKER WRAPPER
   ============================================= */
.color-picker-wrapper {
    position: relative;
    width: 100%;
}

/* =============================================
   SELECTED STATE (TRIGGER BUTTON)
   ============================================= */
.color-picker-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    height: 36px;
}

.color-picker-selected.disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.color-picker-selected:hover:not(.disabled) {
    background: #f0f7ff;
}

/* Focus indicator for accessibility (WCAG 2.4.7) */
.color-picker-selected:focus-visible {
    outline: 2px solid #4169E1;
    outline-offset: 2px;
}

.color-picker-selected .color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid #ccc;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.color-picker-selected .color-swatch.empty {
    background: linear-gradient(135deg, #eee 25%, #ddd 25%, #ddd 50%, #eee 50%, #eee 75%, #ddd 75%);
    background-size: 8px 8px;
}

.color-picker-selected .color-name {
    flex: 1;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.color-picker-selected .color-name.placeholder {
    color: #999;
}

.color-picker-selected .picker-arrow {
    color: #666;
    font-size: 10px;
    flex-shrink: 0;
}

/* =============================================
   DROPDOWN CONTAINER
   ============================================= */
.color-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: white;
    border: 2px solid var(--primary-color, #0d6efd);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    z-index: 1000;
}

.color-picker-dropdown.hidden {
    display: none;
}

/* =============================================
   COLOR OPTIONS (LIST ITEMS)
   ============================================= */
.color-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.color-picker-option:last-child {
    border-bottom: none;
}

.color-picker-option:hover {
    background: #e8f4fd;
}

.color-picker-option.focused {
    background: #d0e8fa;
    outline: 2px solid var(--primary-color, #0d6efd);
    outline-offset: -2px;
}

.color-picker-option.selected {
    background: #e8f5e9;
    font-weight: 600;
}

.color-picker-option .color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #ccc;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.color-picker-option .color-name {
    font-size: 13px;
    color: #333;
}

/* =============================================
   THEME OVERRIDES (per builder)
   ============================================= */

/* Embroidery (blue theme) */
.embroidery-builder .color-picker-dropdown {
    border-color: var(--nwca-blue, #0d6efd);
}

.embroidery-builder .color-picker-option.focused {
    outline-color: var(--nwca-blue, #0d6efd);
}

/* DTF (green theme) */
.dtf-quote-builder .color-picker-dropdown {
    border-color: var(--dtf-primary, #10b981);
}

.dtf-quote-builder .color-picker-option.focused {
    outline-color: var(--dtf-primary, #10b981);
}

.dtf-quote-builder .color-picker-option.selected {
    background: var(--dtf-primary-50, #ecfdf5);
}

/* Screen Print (blue theme) */
.screen-print-builder .color-picker-dropdown {
    border-color: var(--nwca-blue, #0d6efd);
}

.screen-print-builder .color-picker-option.focused {
    outline-color: var(--nwca-blue, #0d6efd);
}
