// Icon Picker Component Styles
.icon-picker-container {
    position: relative;
    margin-bottom: 1rem;

    .icon-picker-label {
        display: block;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--editor-text-primary);
        margin-bottom: 0.5rem;
    }

    .icon-picker-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        border: 1px solid var(--editor-border);
        border-radius: var(--editor-radius-md);
        background: var(--editor-bg-primary);
        cursor: pointer;
        transition: var(--editor-transition);
        box-shadow: var(--editor-shadow-sm);

        &:hover {
            border-color: var(--editor-border-dark);
            box-shadow: var(--editor-shadow-md);
        }

        .selected-icon {
            display: flex;
            align-items: center;
            gap: 0.5rem;

            .icon-display {
                font-size: 1.125rem;
                line-height: 1;
                width: 1.25rem;
                text-align: center;
            }

            .icon-placeholder {
                color: var(--editor-text-muted);
                font-size: 0.875rem;
            }
        }

        .dropdown-arrow {
            color: var(--editor-text-secondary);
            font-size: 0.75rem;
            transition: var(--editor-transition);
        }
    }

    .icon-picker-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--editor-bg-primary);
        border: 1px solid var(--editor-border);
        border-radius: var(--editor-radius-lg);
        box-shadow: var(--editor-shadow-xl);
        z-index: 1000;
        max-height: 400px;
        width: 210px;
        overflow: hidden;
        margin-top: 0.25rem;

        .icon-search {
            padding: 1rem;
            border-bottom: 1px solid var(--editor-border);
            background: var(--editor-bg-secondary);

            .icon-search-input {
                width: 100%;
                padding: 0.75rem;
                border: 1px solid var(--editor-border);
                border-radius: var(--editor-radius-md);
                font-size: 0.875rem;
                background: var(--editor-bg-primary);
                transition: var(--editor-transition);

                &:focus {
                    outline: none;
                    border-color: var(--editor-primary);
                    box-shadow: 0 0 0 3px var(--editor-primary-light);
                }

                &::placeholder {
                    color: var(--editor-text-muted);
                }
            }
        }

        .icon-categories {
            padding: 1rem;
            max-height: 320px;
            overflow-y: auto;

            // Custom scrollbar
            &::-webkit-scrollbar {
                width: 6px;
            }

            &::-webkit-scrollbar-track {
                background: var(--editor-bg-secondary);
                border-radius: 3px;
            }

            &::-webkit-scrollbar-thumb {
                background: var(--editor-border-dark);
                border-radius: 3px;

                &:hover {
                    background: var(--editor-text-muted);
                }
            }

            .icon-category {
                margin-bottom: 1.5rem;

                &:last-child {
                    margin-bottom: 0;
                }

                .category-title {
                    font-size: 0.75rem;
                    font-weight: 700;
                    color: var(--editor-text-secondary);
                    text-transform: uppercase;
                    letter-spacing: 0.05em;
                    margin-bottom: 0.75rem;
                    padding-bottom: 0.25rem;
                    border-bottom: 1px solid var(--editor-border-light);
                    display: flex;
                    align-items: center;
                    justify-content: space-between;

                    .add-custom-icon-btn {
                        background: var(--editor-primary);
                        color: white;
                        border: none;
                        border-radius: 50%;
                        width: 1.5rem;
                        height: 1.5rem;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        cursor: pointer;
                        transition: var(--editor-transition);
                        font-size: 0.75rem;

                        &:hover {
                            background: #9b7bec;
                            transform: scale(1.1);
                        }
                    }
                }

                .icon-grid {
                    display: grid;
                    grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
                    gap: 0.5rem;

                    .icon-option {
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        width: 2.5rem;
                        height: 2.5rem;
                        border: 1px solid var(--editor-border);
                        border-radius: var(--editor-radius-md);
                        background: var(--editor-bg-secondary);
                        cursor: pointer;
                        transition: var(--editor-transition);
                        font-size: 1rem;
                        line-height: 1;

                        &:hover {
                            background: var(--editor-primary-light);
                            border-color: var(--editor-primary);
                            transform: scale(1.05);
                            box-shadow: var(--editor-shadow-sm);
                        }

                        &.selected {
                            background: var(--editor-primary);
                            color: white;
                            border-color: var(--editor-primary);
                            transform: scale(1.05);
                            box-shadow: var(--editor-shadow-md);
                        }
                    }

                    .custom-icon-wrapper {
                        position: relative;

                        .remove-custom-icon {
                            position: absolute;
                            top: -0.25rem;
                            right: -0.25rem;
                            width: 1rem;
                            height: 1rem;
                            background: #dc3545;
                            color: white;
                            border: none;
                            border-radius: 50%;
                            font-size: 0.625rem;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            cursor: pointer;
                            opacity: 0;
                            transition: var(--editor-transition);
                            z-index: 10;

                            &:hover {
                                background: #c82333;
                                transform: scale(1.1);
                            }
                        }

                        &:hover .remove-custom-icon {
                            opacity: 1;
                        }
                    }
                }

                // Custom icons category styling
                &.custom-icons {
                    .category-title {
                        color: var(--editor-primary);
                        border-bottom-color: var(--editor-primary-light);
                    }
                }
            }
        }

        .no-icons-found {
            padding: 2rem;
            text-align: center;
            color: var(--editor-text-muted);
            font-size: 0.875rem;

            p {
                margin: 0;
            }
        }
    }
}

// Custom Icon Modal Styles
.custom-icon-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);

    .custom-icon-modal {
        background: var(--editor-bg-primary);
        border-radius: var(--editor-radius-lg);
        box-shadow: var(--editor-shadow-xl);
        width: 90%;
        max-width: 500px;
        max-height: 90vh;
        overflow: hidden;
        animation: modalSlideIn 0.3s ease-out;

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1.5rem;
            border-bottom: 1px solid var(--editor-border);
            background: var(--editor-bg-secondary);

            h3 {
                margin: 0;
                font-size: 1.25rem;
                font-weight: 600;
                color: var(--editor-text-primary);
            }

            .modal-close {
                background: none;
                border: none;
                font-size: 1.25rem;
                color: var(--editor-text-muted);
                cursor: pointer;
                padding: 0.25rem;
                border-radius: var(--editor-radius-sm);
                transition: var(--editor-transition);

                &:hover {
                    background: var(--editor-bg-tertiary);
                    color: var(--editor-text-primary);
                }
            }
        }

        .modal-body {
            padding: 1.5rem;

            .form-group {
                margin-bottom: 1.5rem;

                &:last-child {
                    margin-bottom: 0;
                }

                label {
                    display: block;
                    font-size: 0.875rem;
                    font-weight: 600;
                    color: var(--editor-text-primary);
                    margin-bottom: 0.5rem;
                }

                .form-control {
                    width: 100%;
                    padding: 0.75rem;
                    border: 1px solid var(--editor-border);
                    border-radius: var(--editor-radius-md);
                    font-size: 0.875rem;
                    background: var(--editor-bg-primary);
                    transition: var(--editor-transition);

                    &:focus {
                        outline: none;
                        border-color: var(--editor-primary);
                        box-shadow: 0 0 0 3px var(--editor-primary-light);
                    }

                    &::placeholder {
                        color: var(--editor-text-muted);
                    }
                }

                .form-help {
                    display: block;
                    font-size: 0.75rem;
                    color: var(--editor-text-muted);
                    margin-top: 0.25rem;
                    line-height: 1.4;
                }
            }

            .icon-preview {
                margin-top: 1rem;
                padding: 1rem;
                background: var(--editor-bg-secondary);
                border-radius: var(--editor-radius-md);
                border: 1px solid var(--editor-border);

                label {
                    font-size: 0.875rem;
                    font-weight: 600;
                    color: var(--editor-text-primary);
                    margin-bottom: 0.5rem;
                    display: block;
                }

                .preview-icon {
                    display: flex;
                    align-items: center;
                    gap: 0.75rem;
                    font-size: 1.125rem;

                    i {
                        width: 1.5rem;
                        text-align: center;
                        color: var(--editor-primary);
                    }

                    span {
                        color: var(--editor-text-primary);
                        font-weight: 500;
                    }
                }
            }
        }

        .modal-footer {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 0.75rem;
            padding: 1.5rem;
            border-top: 1px solid var(--editor-border);
            background: var(--editor-bg-secondary);

            .button {
                padding: 0.75rem 1.5rem;
                border-radius: var(--editor-radius-md);
                font-size: 0.875rem;
                font-weight: 500;
                cursor: pointer;
                transition: var(--editor-transition);
                border: 1px solid transparent;

                &.button-secondary {
                    background: var(--editor-bg-tertiary);
                    color: var(--editor-text-secondary);
                    border-color: var(--editor-border);

                    &:hover {
                        background: var(--editor-bg-primary);
                        color: var(--editor-text-primary);
                    }
                }

                &.button-primary {
                    background: var(--editor-primary);
                    color: white;

                    &:hover:not(:disabled) {
                        background: var(--editor-primary-dark);
                        transform: translateY(-1px);
                        box-shadow: var(--editor-shadow-md);
                    }

                    &:disabled {
                        background: var(--editor-text-muted);
                        cursor: not-allowed;
                        opacity: 0.6;
                    }
                }
            }
        }
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

// Responsive adjustments
@media (max-width: 768px) {
    .icon-picker-container {
        .icon-picker-dropdown {
            .icon-categories {
                padding: 0.75rem;

                .icon-category {
                    .icon-grid {
                        grid-template-columns: repeat(auto-fill, minmax(2rem, 1fr));
                        gap: 0.375rem;

                        .icon-option {
                            width: 2rem;
                            height: 2rem;
                            font-size: 1rem;
                        }
                    }
                }
            }
        }
    }

    .custom-icon-modal-overlay {
        .custom-icon-modal {
            width: 95%;
            margin: 1rem;

            .modal-header,
            .modal-body,
            .modal-footer {
                padding: 1rem;
            }

            .modal-footer {
                flex-direction: column;
                gap: 0.5rem;

                .button {
                    width: 100%;
                }
            }
        }
    }
}