/* Additional CSS for Color Picker Palette and History */

/* Color Palette Section */
.color-palette-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.palette-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.palette-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.palette-controls .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    min-height: 80px;
}

.palette-color {
    position: relative;
    width: 100%;
    height: 80px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.palette-color:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.palette-color-code {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.remove-color {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-color:hover {
    background: #e74c3c;
    transform: scale(1.1);
}

.palette-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Color History Section */
.color-history-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.color-history-section h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.color-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
    min-height: 60px;
}

.history-color {
    position: relative;
    width: 100%;
    height: 60px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.history-color:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.history-color-code {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.history-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .palette-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .palette-controls {
        width: 100%;
        justify-content: center;
    }
    
    .color-palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    .color-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }
    
    .palette-color {
        height: 70px;
    }
    
    .history-color {
        height: 50px;
    }
}

@media (max-width: 480px) {
    .color-palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .color-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .palette-color {
        height: 60px;
    }
    
    .history-color {
        height: 40px;
    }
    
    .palette-color-code,
    .history-color-code {
        font-size: 0.6rem;
        padding: 1px 3px;
    }
}

/* ========== DARK MODE COLOR FIX FOR PALETTE AND HISTORY ========== */
/* Force palette colors to show real colors in dark mode */
[data-theme="dark"] .palette-color {
    background: inherit !important;
    background-color: inherit !important;
    background-image: none !important;
    border: 2px solid var(--border-color) !important;
}

[data-theme="dark"] .palette-color[style] {
    /* When JavaScript sets inline style, respect it completely */
    background: inherit !important;
    background-color: inherit !important;
}

/* Force history colors to show real colors in dark mode */
[data-theme="dark"] .history-color {
    background: inherit !important;
    background-color: inherit !important;
    background-image: none !important;
    border: 2px solid var(--border-color) !important;
}

[data-theme="dark"] .history-color[style] {
    /* When JavaScript sets inline style, respect it completely */
    background: inherit !important;
    background-color: inherit !important;
}

/* Remove any overlay or filter effects */
[data-theme="dark"] .color-palette-grid .palette-color,
[data-theme="dark"] .color-history-grid .history-color {
    filter: none !important;
    opacity: 1 !important;
    background: transparent !important;
}
