.icon-picker-fieldtype {
    position: relative;
}

.icon-picker-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: #6b7280;
}

.icon-picker-trigger:hover {
    border-color: #9ca3af;
}

.icon-picker-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
}

.icon-picker-selected:hover {
    border-color: #9ca3af;
}

.icon-picker-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.icon-picker-preview svg {
    width: 100%;
    height: 100%;
}

.icon-picker-label {
    flex: 1;
    color: #111827;
}

.icon-picker-clear {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: #6b7280;
}

.icon-picker-clear:hover {
    background: #d1d5db;
    color: #111827;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 4px;
    padding: 8px;
    margin-top: 4px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    max-height: 240px;
    overflow-y: auto;
}

.icon-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-picker-item:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.icon-picker-item.is-selected {
    background: #eff6ff;
    border-color: #3b82f6;
}

.icon-picker-item svg {
    width: 100%;
    height: 100%;
}

/*
 * Dark mode. The styles above hardcode light backgrounds and dark text; the
 * control panel follows the OS theme (Tailwind's prefers-color-scheme
 * strategy), so without these overrides the white tiles plus currentColor
 * icons render white-on-white and disappear in dark mode.
 */
@media (prefers-color-scheme: dark) {
    .icon-picker-trigger,
    .icon-picker-selected {
        background: #18181b;
        border-color: rgba(255, 255, 255, 0.1);
        color: #d4d4d8;
    }

    .icon-picker-trigger:hover,
    .icon-picker-selected:hover {
        border-color: rgba(255, 255, 255, 0.25);
    }

    .icon-picker-label {
        color: #f4f4f5;
    }

    .icon-picker-clear {
        background: #3f3f46;
        color: #d4d4d8;
    }

    .icon-picker-clear:hover {
        background: #52525b;
        color: #fff;
    }

    .icon-picker-grid {
        background: #18181b;
        border-color: rgba(255, 255, 255, 0.1);
    }

    .icon-picker-item {
        background: #27272a;
        color: #e4e4e7;
    }

    .icon-picker-item:hover {
        background: #3f3f46;
        border-color: #52525b;
    }

    .icon-picker-item.is-selected {
        background: rgba(59, 130, 246, 0.25);
        border-color: #3b82f6;
    }
}
