/**
 * Modern Color Picker Styles
 * Clean, modern design that integrates seamlessly with the app
 */

.modern-color-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--controls-section-bg);
    border: 2px solid var(--drop-zone-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 140px;
}

.modern-color-button:hover {
    border-color: var(--text-accent);
    transform: translateY(-1px);
}

.modern-color-button.open {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.color-display {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.color-value {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.modern-color-button .chevron {
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.modern-color-button.open .chevron {
    transform: rotate(180deg);
}

.modern-color-picker {
    position: absolute;
    display: none;
    z-index: 1000;
    background: var(--features-bg);
    border: 1px solid var(--controls-section-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    min-width: 280px;
}

.picker-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.color-area {
    display: flex;
    gap: 12px;
}

.saturation-lightness {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    cursor: crosshair;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.sl-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.sl-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 10;
    transition: all 0.1s ease;
}

.hue-strip {
    position: relative;
    width: 20px;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    cursor: ns-resize;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.hue-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hue-cursor {
    position: absolute;
    left: -2px;
    width: 24px;
    height: 4px;
    background: white;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10;
    transition: all 0.1s ease;
}

.color-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.current-color-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.color-preview-bar {
    height: 32px;
    border-radius: 8px;
    border: 2px solid var(--drop-zone-border);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.input-row {
    display: flex;
    gap: 8px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.input-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-inputs input {
    padding: 8px 10px;
    border: 1px solid var(--drop-zone-border);
    border-radius: 6px;
    background: var(--controls-section-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s ease;
}

.color-inputs input:focus {
    outline: none;
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.hex-input {
    text-transform: uppercase;
}

.color-presets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-presets label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preset-colors {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.preset-color {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.preset-color:hover {
    transform: scale(1.1);
    border-color: var(--text-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .modern-color-picker {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    }
    
    .sl-cursor {
        border-color: rgba(255, 255, 255, 0.9);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.4);
    }
    
    .hue-cursor {
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modern-color-picker {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        max-width: 90vw;
    }
    
    .color-area {
        flex-direction: column;
        align-items: center;
    }
    
    .saturation-lightness {
        width: 180px;
        height: 180px;
    }
    
    .hue-strip {
        width: 180px;
        height: 20px;
        cursor: ew-resize;
    }
    
    .hue-cursor {
        left: auto;
        top: -2px;
        width: 4px;
        height: 24px;
    }
    
    .preset-colors {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .preset-color {
        width: 24px;
        height: 24px;
    }
}

/* Animation for smooth opening */
.modern-color-picker {
    animation: colorPickerFadeIn 0.2s ease;
}

@keyframes colorPickerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}