/* Color Picker Specific Styles */

.color-picker-section,
.gradient-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #40444b;
    border-radius: 8px;
    border: 1px solid #202225;
}

.color-picker-section h3,
.gradient-section h3 {
    margin: 0 0 20px 0;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #5865f2;
    padding-bottom: 8px;
}

/* Color Input Container */
.color-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input-container input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.color-input-container input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    background: #2f3136;
    border: 1px solid #202225;
    border-radius: 4px;
    color: #dcddde;
    font-size: 0.9rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.color-input-container input[type="text"]:focus {
    outline: none;
    border-color: #5865f2;
    box-shadow: 0 0 0 1px #5865f2;
}

/* Color Values */
.color-values {
    margin-top: 20px;
}

.value-group {
    margin-bottom: 15px;
}

.value-group label {
    display: block;
    margin-bottom: 6px;
    color: #b9bbbe;
    font-size: 0.9rem;
    font-weight: 500;
}

.value-display {
    display: flex;
    gap: 8px;
    align-items: center;
}

.value-display input {
    flex: 1;
    padding: 8px 12px;
    background: #2f3136;
    border: 1px solid #202225;
    border-radius: 4px;
    color: #dcddde;
    font-size: 0.85rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    cursor: pointer;
}

.value-display input:focus {
    outline: none;
    border-color: #5865f2;
}

.copy-btn {
    padding: 8px 12px;
    background: #5865f2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

/* Gradient Controls */
.gradient-controls {
    display: grid;
    gap: 20px;
}

.gradient-color-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.gradient-color label {
    color: #b9bbbe;
    font-size: 0.9rem;
    font-weight: 500;
}

.gradient-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.gradient-options .input-group {
    margin-bottom: 0;
}

.gradient-options .input-group label {
    margin-bottom: 8px;
    display: block;
}

.gradient-options select {
    width: 100%;
    padding: 10px 12px;
    background: #2f3136;
    border: 1px solid #202225;
    border-radius: 4px;
    color: #dcddde;
    font-size: 0.9rem;
    font-family: 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.gradient-options select:focus {
    outline: none;
    border-color: #5865f2;
    box-shadow: 0 0 0 1px #5865f2;
}

.gradient-options select:hover {
    border-color: #40444b;
}

.gradient-options select option {
    background: #2f3136;
    color: #dcddde;
    padding: 8px;
}

.gradient-css {
    margin-top: 20px;
}

.gradient-css label {
    display: block;
    margin-bottom: 8px;
    color: #b9bbbe;
    font-size: 0.9rem;
    font-weight: 500;
}

.gradient-css textarea {
    width: 100%;
    padding: 12px;
    background: #2f3136;
    border: 1px solid #202225;
    border-radius: 4px;
    color: #dcddde;
    font-size: 0.85rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    resize: vertical;
    min-height: 80px;
}

.gradient-css textarea:focus {
    outline: none;
    border-color: #5865f2;
}


/* Preview Section */
.color-preview-container,
.gradient-preview-container {
    margin-bottom: 30px;
}

.color-preview,
.gradient-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #40444b;
    border-radius: 8px;
    border: 1px solid #202225;
}

.color-swatch,
.gradient-swatch {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: 2px solid #202225;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.color-swatch {
    background: #5865f2;
}

.gradient-swatch {
    background: linear-gradient(45deg, #5865f2, #4752c4);
}

.color-info,
.gradient-info {
    flex: 1;
}

.color-info h4,
.gradient-info h4 {
    margin: 0 0 8px 0;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
}

.color-info p,
.gradient-info p {
    margin: 0;
    color: #b9bbbe;
    font-size: 0.9rem;
}

/* Color Palette */
.color-palette {
    margin-top: 30px;
    padding: 20px;
    background: #40444b;
    border-radius: 8px;
    border: 1px solid #202225;
}

.color-palette h4 {
    margin: 0 0 8px 0;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.palette-hint {
    margin: 0 0 15px 0;
    color: #72767d;
    font-size: 0.85rem;
    font-style: italic;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
}

.palette-color {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.palette-color:hover {
    transform: scale(1.1);
    border-color: #5865f2;
    z-index: 10;
}

.palette-color:hover::before {
    content: '✎';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.palette-color::after {
    content: attr(data-color);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #2f3136;
    color: #dcddde;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
}

.palette-color:hover::after {
    opacity: 1;
}

/* Collection Management Styles */
.collection-management {
    margin-top: 30px;
    padding: 20px;
    background: #40444b;
    border-radius: 8px;
    border: 1px solid #202225;
}

.collection-management h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #dcddde;
    margin: 0 0 15px 0;
}

.save-collection-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.save-collection-section input {
    flex: 1;
    padding: 10px;
    border: 1px solid #202225;
    border-radius: 4px;
    background: #2f3136;
    color: #dcddde;
    font-size: 0.9rem;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.save-collection-section input:focus {
    outline: none;
    border-color: #5865f2;
}

.save-button {
    padding: 10px 20px;
    background: #5865f2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.save-button:hover {
    background: #4752c4;
}

.saved-collections-section {
    margin-top: 20px;
}

.search-container {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #202225;
    border-radius: 4px;
    background: #2f3136;
    color: #dcddde;
    font-size: 0.9rem;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.search-input:focus {
    outline: none;
    border-color: #5865f2;
}

.select-all-btn {
    padding: 10px 16px;
    background: #4f545c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.select-all-btn:hover {
    background: #5d6269;
}

.selection-hint {
    margin: 10px 0;
    color: #72767d;
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
}

.saved-collections-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.no-collections-message {
    text-align: center;
    color: #72767d;
    padding: 30px;
    font-size: 0.9rem;
}

.saved-collection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #2f3136;
    border-radius: 4px;
    border: 1px solid #202225;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.saved-collection-item:hover {
    background: #36393f;
    border-color: #5865f2;
}

.saved-collection-item.selected {
    background: #3a4557;
    border-color: #5865f2;
    border-width: 2px;
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.saved-collection-item.selected::before {
    content: '✓';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #5865f2;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.collection-info-display {
    flex: 1;
    min-width: 0;
}

.collection-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.source-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
}

.source-badge.local {
    background-color: #7289da;
}

.source-badge.cloud {
    background-color: #43b581;
}

.collection-details {
    font-size: 0.8rem;
    color: #b9bbbe;
}

.collection-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.load-button,
.delete-button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.load-button {
    background: #5865f2;
    color: white;
}

.load-button:hover {
    background: #4752c4;
}

.delete-button {
    background: #ed4245;
    color: white;
}

.delete-button:hover {
    background: #c03537;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding: 20px;
    background: #40444b;
    border-radius: 8px;
    border: 1px solid #202225;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #5865f2;
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: #4752c4;
}

.btn-primary.has-selection {
    background: #43b581;
    animation: pulse 2s infinite;
}

.btn-primary.has-selection:hover {
    background: #3ca374;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(67, 181, 129, 0);
    }
}

.btn-secondary {
    background: #4f545c;
    color: white;
}

.btn-secondary:hover {
    background: #5d6269;
}

/* Custom scrollbar for saved collections list */
.saved-collections-list::-webkit-scrollbar {
    width: 8px;
}

.saved-collections-list::-webkit-scrollbar-track {
    background: #2f3136;
    border-radius: 4px;
}

.saved-collections-list::-webkit-scrollbar-thumb {
    background: #4f545c;
    border-radius: 4px;
    border: 1px solid #2f3136;
}

.saved-collections-list::-webkit-scrollbar-thumb:hover {
    background: #5d6269;
}

/* Responsive Design */
@media (max-width: 768px) {
    .editor-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .gradient-color-inputs {
        grid-template-columns: 1fr;
    }

    .gradient-options {
        grid-template-columns: 1fr;
    }

    .color-preview,
    .gradient-preview {
        flex-direction: column;
        text-align: center;
    }

    .color-swatch,
    .gradient-swatch {
        width: 100px;
        height: 100px;
    }


    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .color-picker-section,
    .gradient-section,
    .preset-section,
    .color-palette {
        padding: 15px;
    }

    .value-display {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-btn {
        width: 100%;
    }


    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(25px, 1fr));
    }
}
